home *** CD-ROM | disk | FTP | other *** search
/ Languguage OS 2 / Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO / gnu / libg_261.zip / libg_261 / texinfo / texinfo.tex (.txt) < prev   
LaTeX Document  |  1994-01-26  |  135KB  |  3,294 lines

  1. %% TeX macros to handle texinfo files
  2. %   Copyright (C) 1985, 86, 88, 90, 91, 92, 1993 Free Software Foundation, Inc.
  3. %This texinfo.tex file is free software; you can redistribute it and/or
  4. %modify it under the terms of the GNU General Public License as
  5. %published by the Free Software Foundation; either version 2, or (at
  6. %your option) any later version.
  7. %This texinfo.tex file is distributed in the hope that it will be
  8. %useful, but WITHOUT ANY WARRANTY; without even the implied warranty
  9. %of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  10. %General Public License for more details.
  11. %You should have received a copy of the GNU General Public License
  12. %along with this texinfo.tex file; see the file COPYING.  If not, write
  13. %to the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139,
  14. %USA.
  15. %In other words, you are welcome to use, share and improve this program.
  16. %You are forbidden to forbid anyone else to use, share and improve
  17. %what you give them.   Help stamp out software-hoarding!
  18. \def\texinfoversion{2.122}
  19. \message{Loading texinfo package [Version \texinfoversion]:}
  20. % Print the version number if in a .fmt file.
  21. \everyjob{\message{[Texinfo version \texinfoversion]}\message{}}
  22. % Save some parts of plain tex whose names we will redefine.
  23. \let\ptexlbrace=\{
  24. \let\ptexrbrace=\}
  25. \let\ptexdots=\dots
  26. \let\ptexdot=\.
  27. \let\ptexstar=\*
  28. \let\ptexend=\end
  29. \let\ptexbullet=\bullet
  30. \let\ptexb=\b
  31. \let\ptexc=\c
  32. \let\ptexi=\i
  33. \let\ptext=\t
  34. \let\ptexl=\l
  35. \let\ptexL=\L
  36. \def\tie{\penalty 10000\ }     % Save plain tex definition of ~.
  37. \message{Basics,}
  38. \chardef\other=12
  39. % If this character appears in an error message or help string, it
  40. % starts a new line in the output.
  41. \newlinechar = `^^J
  42. % Set up fixed words for English.
  43. \ifx\putwordChapter\undefined{\gdef\putwordChapter{Chapter}}\fi%
  44. \def\putwordInfo{Info}%
  45. \ifx\putwordSee\undefined{\gdef\putwordSee{See}}\fi%
  46. \ifx\putwordsee\undefined{\gdef\putwordsee{see}}\fi%
  47. \ifx\putwordfile\undefined{\gdef\putwordfile{file}}\fi%
  48. \ifx\putwordpage\undefined{\gdef\putwordpage{page}}\fi%
  49. \ifx\putwordsection\undefined{\gdef\putwordsection{section}}\fi%
  50. \ifx\putwordSection\undefined{\gdef\putwordSection{Section}}\fi%
  51. \ifx\putwordTableofContents\undefined{\gdef\putwordTableofContents{Table of Contents}}\fi%
  52. \ifx\putwordShortContents\undefined{\gdef\putwordShortContents{Short Contents}}\fi%
  53. \ifx\putwordAppendix\undefined{\gdef\putwordAppendix{Appendix}}\fi%
  54. % Ignore a token.
  55. \def\gobble#1{}
  56. \hyphenation{ap-pen-dix}
  57. \hyphenation{mini-buf-fer mini-buf-fers}
  58. \hyphenation{eshell}
  59. % Margin to add to right of even pages, to left of odd pages.
  60. \newdimen \bindingoffset  \bindingoffset=0pt
  61. \newdimen \normaloffset   \normaloffset=\hoffset
  62. \newdimen\pagewidth \newdimen\pageheight
  63. \pagewidth=\hsize \pageheight=\vsize
  64. % Sometimes it is convenient to have everything in the transcript file
  65. % and nothing on the terminal.  We don't just call \tracingall here,
  66. % since that produces some useless output on the terminal.
  67. \def\gloggingall{\begingroup \globaldefs = 1 \loggingall \endgroup}%
  68. \def\loggingall{\tracingcommands2 \tracingstats2
  69.    \tracingpages1 \tracingoutput1 \tracinglostchars1
  70.    \tracingmacros2 \tracingparagraphs1 \tracingrestores1
  71.    \showboxbreadth\maxdimen\showboxdepth\maxdimen
  72. %---------------------Begin change-----------------------
  73. %%%% For @cropmarks command.
  74. % Dimensions to add cropmarks at corners Added by P. A. MacKay, 12 Nov. 1986
  75. \newdimen\cornerlong \newdimen\cornerthick
  76. \newdimen \topandbottommargin
  77. \newdimen \outerhsize \newdimen \outervsize
  78. \cornerlong=1pc\cornerthick=.3pt    % These set size of cropmarks
  79. \outerhsize=7in
  80. %\outervsize=9.5in
  81. % Alternative @smallbook page size is 9.25in
  82. \outervsize=9.25in
  83. \topandbottommargin=.75in
  84. %---------------------End change-----------------------
  85. % \onepageout takes a vbox as an argument.  Note that \pagecontents
  86. % does insertions itself, but you have to call it yourself.
  87. \chardef\PAGE=255  \output={\onepageout{\pagecontents\PAGE}}
  88. \def\onepageout#1{\hoffset=\normaloffset
  89. \ifodd\pageno  \advance\hoffset by \bindingoffset
  90. \else \advance\hoffset by -\bindingoffset\fi
  91. {\escapechar=`\\\relax % makes sure backslash is used in output files.
  92. \shipout\vbox{{\let\hsize=\pagewidth \makeheadline} \pagebody{#1}%
  93. {\let\hsize=\pagewidth \makefootline}}}%
  94. \advancepageno \ifnum\outputpenalty>-20000 \else\dosupereject\fi}
  95. %%%% For @cropmarks command %%%%
  96. % Here is a modification of the main output routine for Near East Publications
  97. % This provides right-angle cropmarks at all four corners.
  98. % The contents of the page are centerlined into the cropmarks,
  99. % and any desired binding offset is added as an \hskip on either
  100. % site of the centerlined box.  (P. A. MacKay, 12 November, 1986)
  101. \def\croppageout#1{\hoffset=0pt % make sure this doesn't mess things up
  102. {\escapechar=`\\\relax % makes sure backslash is used in output files.
  103.          \shipout
  104.          \vbox to \outervsize{\hsize=\outerhsize
  105.                  \vbox{\line{\ewtop\hfill\ewtop}}
  106.                  \nointerlineskip
  107.                  \line{\vbox{\moveleft\cornerthick\nstop}
  108.                        \hfill
  109.                        \vbox{\moveright\cornerthick\nstop}}
  110.                  \vskip \topandbottommargin
  111.                  \centerline{\ifodd\pageno\hskip\bindingoffset\fi
  112.             \vbox{
  113.             {\let\hsize=\pagewidth \makeheadline}
  114.             \pagebody{#1}
  115.             {\let\hsize=\pagewidth \makefootline}}
  116.             \ifodd\pageno\else\hskip\bindingoffset\fi}
  117.          \vskip \topandbottommargin plus1fill minus1fill
  118.                  \boxmaxdepth\cornerthick
  119.                  \line{\vbox{\moveleft\cornerthick\nsbot}
  120.                        \hfill
  121.                        \vbox{\moveright\cornerthick\nsbot}}
  122.                  \nointerlineskip
  123.                  \vbox{\line{\ewbot\hfill\ewbot}}
  124.   \advancepageno
  125.   \ifnum\outputpenalty>-20000 \else\dosupereject\fi}
  126. % Do @cropmarks to get crop marks
  127. \def\cropmarks{\let\onepageout=\croppageout }
  128. \def\pagebody#1{\vbox to\pageheight{\boxmaxdepth=\maxdepth #1}}
  129. {\catcode`\@ =11
  130. \gdef\pagecontents#1{\ifvoid\topins\else\unvbox\topins\fi
  131. \dimen@=\dp#1 \unvbox#1
  132. \ifvoid\footins\else\vskip\skip\footins\footnoterule \unvbox\footins\fi
  133. \ifr@ggedbottom \kern-\dimen@ \vfil \fi}
  134. % Here are the rules for the cropmarks.  Note that they are
  135. % offset so that the space between them is truly \outerhsize or \outervsize
  136. % (P. A. MacKay, 12 November, 1986)
  137. \def\ewtop{\vrule height\cornerthick depth0pt width\cornerlong}
  138. \def\nstop{\vbox
  139.   {\hrule height\cornerthick depth\cornerlong width\cornerthick}}
  140. \def\ewbot{\vrule height0pt depth\cornerthick width\cornerlong}
  141. \def\nsbot{\vbox
  142.   {\hrule height\cornerlong depth\cornerthick width\cornerthick}}
  143. % Parse an argument, then pass it to #1.  The argument is the rest of
  144. % the input line (except we remove a trailing comment).  #1 should be a
  145. % macro which expects an ordinary undelimited TeX argument.
  146. \def\parsearg#1{%
  147.   \let\next = #1%
  148.   \begingroup
  149.     \obeylines
  150.     \futurelet\temp\parseargx
  151. % If the next token is an obeyed space (from an @example environment or
  152. % the like), remove it and recurse.  Otherwise, we're done.
  153. \def\parseargx{%
  154.   % \obeyedspace is defined far below, after the definition of \sepspaces.
  155.   \ifx\obeyedspace\temp
  156.     \expandafter\parseargdiscardspace
  157.   \else
  158.     \expandafter\parseargline
  159.   \fi
  160. % Remove a single space (as the delimiter token to the macro call).
  161. {\obeyspaces %
  162.  \gdef\parseargdiscardspace {\futurelet\temp\parseargx}}
  163. {\obeylines %
  164.   \gdef\parseargline#1^^M{%
  165.     \endgroup % End of the group started in \parsearg.
  166.     %
  167.     % First remove any @c comment, then any @comment.
  168.     % Result of each macro is put in \toks0.
  169.     \argremovec #1\c\relax %
  170.     \expandafter\argremovecomment \the\toks0 \comment\relax %
  171.     %
  172.     % Call the caller's macro, saved as \next in \parsearg.
  173.     \expandafter\next\expandafter{\the\toks0}%
  174. % Since all \c{,omment} does is throw away the argument, we can let TeX
  175. % do that for us.  The \relax here is matched by the \relax in the call
  176. % in \parseargline; it could be more or less anything, its purpose is
  177. % just to delimit the argument to the \c.
  178. \def\argremovec#1\c#2\relax{\toks0 = {#1}}
  179. \def\argremovecomment#1\comment#2\relax{\toks0 = {#1}}
  180. % \argremovec{,omment} might leave us with trailing spaces, though; e.g.,
  181. %    @end itemize  @c foo
  182. % will have two active spaces as part of the argument with the
  183. % `itemize'.  Here we remove all active spaces from #1, and assign the
  184. % result to \toks0.
  185. % This loses if there are any *other* active characters besides spaces
  186. % in the argument -- _ ^ +, for example -- since they get expanded.
  187. % Fortunately, Texinfo does not define any such commands.  (If it ever
  188. % does, the catcode of the characters in questionwill have to be changed
  189. % here.)  But this means we cannot call \removeactivespaces as part of
  190. % \argremovec{,omment}, since @c uses \parsearg, and thus the argument
  191. % that \parsearg gets might well have any character at all in it.
  192. \def\removeactivespaces#1{%
  193.   \begingroup
  194.     \ignoreactivespaces
  195.     \edef\temp{#1}%
  196.     \global\toks0 = \expandafter{\temp}%
  197.   \endgroup
  198. % Change the active space to expand to nothing.
  199. \begingroup
  200.   \obeyspaces
  201.   \gdef\ignoreactivespaces{\obeyspaces\let =\empty}
  202. \endgroup
  203. \def\flushcr{\ifx\par\lisppar \def\next##1{}\else \let\next=\relax \fi \next}
  204. %% These are used to keep @begin/@end levels from running away
  205. %% Call \inENV within environments (after a \begingroup)
  206. \newif\ifENV \ENVfalse \def\inENV{\ifENV\relax\else\ENVtrue\fi}
  207. \def\ENVcheck{%
  208. \ifENV\errmessage{Still within an environment.  Type Return to continue.}
  209. \endgroup\fi} % This is not perfect, but it should reduce lossage
  210. % @begin foo  is the same as @foo, for now.
  211. \newhelp\EMsimple{Type <Return> to continue.}
  212. \outer\def\begin{\parsearg\beginxxx}
  213. \def\beginxxx #1{%
  214. \expandafter\ifx\csname #1\endcsname\relax
  215. {\errhelp=\EMsimple \errmessage{Undefined command @begin #1}}\else
  216. \csname #1\endcsname\fi}
  217. % @end foo executes the definition of \Efoo.
  218. \def\end{\parsearg\endxxx}
  219. \def\endxxx #1{%
  220.   \removeactivespaces{#1}%
  221.   \edef\endthing{\the\toks0}%
  222.   \expandafter\ifx\csname E\endthing\endcsname\relax
  223.     \expandafter\ifx\csname \endthing\endcsname\relax
  224.       % There's no \foo, i.e., no ``environment'' foo.
  225.       \errhelp = \EMsimple
  226.       \errmessage{Undefined command `@end \endthing'}%
  227.     \else
  228.       \unmatchedenderror\endthing
  229.     \fi
  230.   \else
  231.     % Everything's ok; the right environment has been started.
  232.     \csname E\endthing\endcsname
  233.   \fi
  234. % There is an environment #1, but it hasn't been started.  Give an error.
  235. \def\unmatchedenderror#1{%
  236.   \errhelp = \EMsimple
  237.   \errmessage{This `@end #1' doesn't have a matching `@#1'}%
  238. % Define the control sequence \E#1 to give an unmatched @end error.
  239. \def\defineunmatchedend#1{%
  240.   \expandafter\def\csname E#1\endcsname{\unmatchedenderror{#1}}%
  241. % Single-spacing is done by various environments (specifically, in
  242. % \nonfillstart and \quotations).
  243. \newskip\singlespaceskip \singlespaceskip = \baselineskip
  244. \def\singlespace{%
  245. % Why was this kern here?  It messes up equalizing space above and below
  246. % environments.  --karl, 6may93
  247. %{\advance \baselineskip by -\singlespaceskip
  248. %\kern \baselineskip}%
  249. \baselineskip=\singlespaceskip
  250. %% Simple single-character @ commands
  251. % @@ prints an @
  252. % Kludge this until the fonts are right (grr).
  253. \def\@{{\tt \char '100}}
  254. % This is turned off because it was never documented
  255. % and you can use @w{...} around a quote to suppress ligatures.
  256. %% Define @` and @' to be the same as ` and '
  257. %% but suppressing ligatures.
  258. %\def\`{{`}}
  259. %\def\'{{'}}
  260. % Used to generate quoted braces.
  261. \def\mylbrace {{\tt \char '173}}
  262. \def\myrbrace {{\tt \char '175}}
  263. \let\{=\mylbrace
  264. \let\}=\myrbrace
  265. % @: forces normal size whitespace following.
  266. \def\:{\spacefactor=1000 }
  267. % @* forces a line break.
  268. \def\*{\hfil\break\hbox{}\ignorespaces}
  269. % @. is an end-of-sentence period.
  270. \def\.{.\spacefactor=3000 }
  271. % @w prevents a word break.  Without the \leavevmode, @w at the
  272. % beginning of a paragraph, when TeX is still in vertical mode, would
  273. % produce a whole line of output instead of starting the paragraph.
  274. \def\w#1{\leavevmode\hbox{#1}}
  275. % @group ... @end group forces ... to be all on one page, by enclosing
  276. % it in a TeX vbox.  We use \vtop instead of \vbox to construct the box
  277. % to keep its height that of a normal line.  According to the rules for
  278. % \topskip (p.114 of the TeXbook), the glue inserted is
  279. % max (\topskip - \ht (first item), 0).  If that height is large,
  280. % therefore, no glue is inserted, and the space between the headline and
  281. % the text is small, which looks bad.
  282. \def\group{\begingroup
  283.   \ifnum\catcode13=\active \else
  284.     \errhelp = \groupinvalidhelp
  285.     \errmessage{@group invalid in context where filling is enabled}%
  286.   \fi
  287.   % The \vtop we start below produces a box with normal height and large
  288.   % depth; thus, TeX puts \baselineskip glue before it, and (when the
  289.   % next line of text is done) \lineskip glue after it.  (See p.82 of
  290.   % the TeXbook.)  Thus, space below is not quite equal to space
  291.   % above.  But it's pretty close.
  292.   \def\Egroup{%
  293.     \egroup           % End the \vtop.
  294.     \endgroup         % End the \group.
  295.   \vtop\bgroup
  296.     % We have to put a strut on the last line in case the @group is in
  297.     % the midst of an example, rather than completely enclosing it.
  298.     % Otherwise, the interline space between the last line of the group
  299.     % and the first line afterwards is too small.  But we can't put the
  300.     % strut in \Egroup, since there it would be on a line by itself.
  301.     % Hence this just inserts a strut at the beginning of each line.
  302.     \everypar = {\strut}%
  303.     %
  304.     % Since we have a strut on every line, we don't need any of TeX's
  305.     % normal interline spacing.
  306.     \offinterlineskip
  307.     %
  308.     % OK, but now we have to do something about blank
  309.     % lines in the input in @example-like environments, which normally
  310.     % just turn into \lisppar, which will insert no space now that we've
  311.     % turned off the interline space.  Simplest is to make them be an
  312.     % empty paragraph.
  313.     \ifx\par\lisppar
  314.       \edef\par{\leavevmode \par}%
  315.       %
  316.       % Reset ^^M's definition to new definition of \par.
  317.       \obeylines
  318.     \fi
  319.     %
  320.     % We do @comment here in case we are called inside an environment,
  321.     % such as @example, where each end-of-line in the input causes an
  322.     % end-of-line in the output.  We don't want the end-of-line after
  323.     % the `@group' to put extra space in the output.  Since @group
  324.     % should appear on a line by itself (according to the Texinfo
  325.     % manual), we don't worry about eating any user text.
  326.     \comment
  327. % TeX puts in an \escapechar (i.e., `@') at the beginning of the help
  328. % message, so this ends up printing `@group can only ...'.
  329. \newhelp\groupinvalidhelp{%
  330. group can only be used in environments such as @example,^^J%
  331. where each line of input produces a line of output.}
  332. % @need space-in-mils
  333. % forces a page break if there is not space-in-mils remaining.
  334. \newdimen\mil  \mil=0.001in
  335. \def\need{\parsearg\needx}
  336. % Old definition--didn't work.
  337. %\def\needx #1{\par %
  338. %% This method tries to make TeX break the page naturally
  339. %% if the depth of the box does not fit.
  340. %{\baselineskip=0pt%
  341. %\vtop to #1\mil{\vfil}\kern -#1\mil\penalty 10000
  342. %\prevdepth=-1000pt
  343. \def\needx#1{%
  344.   % Go into vertical mode, so we don't make a big box in the middle of a
  345.   % paragraph.
  346.   \par
  347.   % Don't add any leading before our big empty box, but allow a page
  348.   % break, since the best break might be right here.
  349.   \allowbreak
  350.   \nointerlineskip
  351.   \vtop to #1\mil{\vfil}%
  352.   % TeX does not even consider page breaks if a penalty added to the
  353.   % main vertical list is 10000 or more.  But in order to see if the
  354.   % empty box we just added fits on the page, we must make it consider
  355.   % page breaks.  On the other hand, we don't want to actually break the
  356.   % page after the empty box.  So we use a penalty of 9999.
  357.   % There is an extremely small chance that TeX will actually break the
  358.   % page at this \penalty, if there are no other feasible breakpoints in
  359.   % sight.  (If the user is using lots of big @group commands, which
  360.   % almost-but-not-quite fill up a page, TeX will have a hard time doing
  361.   % good page breaking, for example.)  However, I could not construct an
  362.   % example where a page broke at this \penalty; if it happens in a real
  363.   % document, then we can reconsider our strategy.
  364.   \penalty9999
  365.   % Back up by the size of the box, whether we did a page break or not.
  366.   \kern -#1\mil
  367.   % Do not allow a page break right after this kern.
  368.   \nobreak
  369. % @br   forces paragraph break
  370. \let\br = \par
  371. % @dots{}  output some dots
  372. \def\dots{.$\,$.$\,$.\:}
  373. % @page    forces the start of a new page
  374. \def\page{\par\vfill\supereject}
  375. % @exdent text....
  376. % outputs text on separate line in roman font, starting at standard page margin
  377. % This records the amount of indent in the innermost environment.
  378. % That's how much \exdent should take out.
  379. \newskip\exdentamount
  380. % This defn is used inside fill environments such as @defun.
  381. \def\exdent{\parsearg\exdentyyy}
  382. \def\exdentyyy #1{{\hfil\break\hbox{\kern -\exdentamount{\rm#1}}\hfil\break}}
  383. % This defn is used inside nofill environments such as @example.
  384. \def\nofillexdent{\parsearg\nofillexdentyyy}
  385. \def\nofillexdentyyy #1{{\advance \leftskip by -\exdentamount
  386. \leftline{\hskip\leftskip{\rm#1}}}}
  387. %\hbox{{\rm#1}}\hfil\break}}
  388. % @include file    insert text of that file as input.
  389. \def\include{\parsearg\includezzz}
  390. %Use \input\thisfile to avoid blank after \input, which may be an active
  391. %char (in which case the blank would become the \input argument).
  392. %The grouping keeps the value of \thisfile correct even when @include
  393. %is nested.
  394. \def\includezzz #1{\begingroup
  395. \def\thisfile{#1}\input\thisfile
  396. \endgroup}
  397. \def\thisfile{}
  398. % @center line   outputs that line, centered
  399. \def\center{\parsearg\centerzzz}
  400. \def\centerzzz #1{{\advance\hsize by -\leftskip
  401. \advance\hsize by -\rightskip
  402. \centerline{#1}}}
  403. % @sp n   outputs n lines of vertical space
  404. \def\sp{\parsearg\spxxx}
  405. \def\spxxx #1{\par \vskip #1\baselineskip}
  406. % @comment ...line which is ignored...
  407. % @c is the same as @comment
  408. % @ignore ... @end ignore  is another way to write a comment
  409. \def\comment{\catcode 64=\other \catcode 123=\other \catcode 125=\other%
  410. \parsearg \commentxxx}
  411. \def\commentxxx #1{\catcode 64=0 \catcode 123=1 \catcode 125=2 }
  412. \let\c=\comment
  413. % Prevent errors for section commands.
  414. % Used in @ignore and in failing conditionals.
  415. \def\ignoresections{%
  416. \let\chapter=\relax
  417. \let\unnumbered=\relax
  418. \let\top=\relax
  419. \let\unnumberedsec=\relax
  420. \let\unnumberedsection=\relax
  421. \let\unnumberedsubsec=\relax
  422. \let\unnumberedsubsection=\relax
  423. \let\unnumberedsubsubsec=\relax
  424. \let\unnumberedsubsubsection=\relax
  425. \let\section=\relax
  426. \let\subsec=\relax
  427. \let\subsubsec=\relax
  428. \let\subsection=\relax
  429. \let\subsubsection=\relax
  430. \let\appendix=\relax
  431. \let\appendixsec=\relax
  432. \let\appendixsection=\relax
  433. \let\appendixsubsec=\relax
  434. \let\appendixsubsection=\relax
  435. \let\appendixsubsubsec=\relax
  436. \let\appendixsubsubsection=\relax
  437. \let\contents=\relax
  438. \let\smallbook=\relax
  439. \let\titlepage=\relax
  440. % Used in nested conditionals, where we have to parse the Texinfo source
  441. % and so want to turn off most commands, in case they are used
  442. % incorrectly.
  443. \def\ignoremorecommands{%
  444.   \let\defcv = \relax
  445.   \let\deffn = \relax
  446.   \let\deffnx = \relax
  447.   \let\defindex = \relax
  448.   \let\defivar = \relax
  449.   \let\defmac = \relax
  450.   \let\defmethod = \relax
  451.   \let\defop = \relax
  452.   \let\defopt = \relax
  453.   \let\defspec = \relax
  454.   \let\deftp = \relax
  455.   \let\deftypefn = \relax
  456.   \let\deftypefun = \relax
  457.   \let\deftypevar = \relax
  458.   \let\deftypevr = \relax
  459.   \let\defun = \relax
  460.   \let\defvar = \relax
  461.   \let\defvr = \relax
  462.   \let\ref = \relax
  463.   \let\xref = \relax
  464.   \let\printindex = \relax
  465.   \let\pxref = \relax
  466.   \let\settitle = \relax
  467.   \let\include = \relax
  468.   \let\lowersections = \relax
  469.   \let\down = \relax
  470.   \let\raisesections = \relax
  471.   \let\up = \relax
  472.   \let\set = \relax
  473.   \let\clear = \relax
  474.   \let\item = \relax
  475.   \let\message = \relax
  476. % Ignore @ignore ... @end ignore.
  477. \def\ignore{\doignore{ignore}}
  478. % Also ignore @ifinfo, @menu, and @direntry text.
  479. \def\ifinfo{\doignore{ifinfo}}
  480. \def\menu{\doignore{menu}}
  481. \def\direntry{\doignore{direntry}}
  482. % Ignore text until a line `@end #1'.
  483. \def\doignore#1{\begingroup
  484.   % Don't complain about control sequences we have declared \outer.
  485.   \ignoresections
  486.   % Define a command to swallow text until we reach `@end #1'.
  487.   \long\def\doignoretext##1\end #1{\enddoignore}%
  488.   % Make sure that spaces turn into tokens that match what \doignoretext wants.
  489.   \catcode32 = 10
  490.   % And now expand that command.
  491.   \doignoretext
  492. % What we do to finish off ignored text.
  493. \def\enddoignore{\endgroup\ignorespaces}%
  494. \newif\ifwarnedobs\warnedobsfalse
  495. \def\obstexwarn{%
  496.   \ifwarnedobs\relax\else
  497.   % We need to warn folks that they may have trouble with TeX 3.0.
  498.   % This uses \immediate\write16 rather than \message to get newlines.
  499.     \immediate\write16{}
  500.     \immediate\write16{***WARNING*** for users of Unix TeX 3.0!}
  501.     \immediate\write16{This manual trips a bug in TeX version 3.0 (tex hangs).}
  502.     \immediate\write16{If you are running another version of TeX, relax.}
  503.     \immediate\write16{If you are running Unix TeX 3.0, kill this TeX process.}
  504.     \immediate\write16{  Then upgrade your TeX installation if you can.}
  505.     \immediate\write16{If you are stuck with version 3.0, run the}
  506.     \immediate\write16{  script ``tex3patch'' from the Texinfo distribution}
  507.     \immediate\write16{  to use a workaround.}
  508.     \immediate\write16{}
  509.     \warnedobstrue
  510.     \fi
  511. % **In TeX 3.0, setting text in \nullfont hangs tex.  For a
  512. % workaround (which requires the file ``dummy.tfm'' to be installed),
  513. % uncomment the following line:
  514. %%%%%\font\nullfont=dummy\let\obstexwarn=\relax
  515. % Ignore text, except that we keep track of conditional commands for
  516. % purposes of nesting, up to an `@end #1' command.
  517. \def\nestedignore#1{%
  518.   \obstexwarn
  519.   % We must actually expand the ignored text to look for the @end
  520.   % command, so that nested ignore constructs work.  Thus, we put the
  521.   % text into a \vbox and then do nothing with the result.  To minimize
  522.   % the change of memory overflow, we follow the approach outlined on
  523.   % page 401 of the TeXbook: make the current font be a dummy font.
  524.   \setbox0 = \vbox\bgroup
  525.     % Don't complain about control sequences we have declared \outer.
  526.     \ignoresections
  527.     %
  528.     % Define `@end #1' to end the box, which will in turn undefine the
  529.     % @end command again.
  530.     \expandafter\def\csname E#1\endcsname{\egroup\ignorespaces}%
  531.     %
  532.     % We are going to be parsing Texinfo commands.  Most cause no
  533.     % trouble when they are used incorrectly, but some commands do
  534.     % complicated argument parsing or otherwise get confused, so we
  535.     % undefine them.
  536.     %
  537.     % We can't do anything about stray @-signs, unfortunately;
  538.     % they'll produce `undefined control sequence' errors.
  539.     \ignoremorecommands
  540.     %
  541.     % Set the current font to be \nullfont, a TeX primitive, and define
  542.     % all the font commands to also use \nullfont.  We don't use
  543.     % dummy.tfm, as suggested in the TeXbook, because not all sites
  544.     % might have that installed.  Therefore, math mode will still
  545.     % produce output, but that should be an extremely small amount of
  546.     % stuff compared to the main input.
  547.     %
  548.     \nullfont
  549.     \let\tenrm = \nullfont  \let\tenit = \nullfont  \let\tensl = \nullfont
  550.     \let\tenbf = \nullfont  \let\tentt = \nullfont  \let\smallcaps = \nullfont
  551.     \let\tensf = \nullfont
  552.     % Similarly for index fonts (mostly for their use in
  553.     % smallexample)
  554.     \let\indrm = \nullfont  \let\indit = \nullfont  \let\indsl = \nullfont
  555.     \let\indbf = \nullfont  \let\indtt = \nullfont  \let\indsc = \nullfont
  556.     \let\indsf = \nullfont
  557.     %
  558.     % Don't complain when characters are missing from the fonts.
  559.     \tracinglostchars = 0
  560.     %
  561.     % Don't bother to do space factor calculations.
  562.     \frenchspacing
  563.     %
  564.     % Don't report underfull hboxes.
  565.     \hbadness = 10000
  566.     %
  567.     % Do minimal line-breaking.
  568.     \pretolerance = 10000
  569.     %
  570.     % Do not execute instructions in @tex
  571.     \def\tex{\doignore{tex}}
  572. % @set VAR sets the variable VAR to an empty value.
  573. % @set VAR REST-OF-LINE sets VAR to the value REST-OF-LINE.
  574. % Since we want to separate VAR from REST-OF-LINE (which might be
  575. % empty), we can't just use \parsearg; we have to insert a space of our
  576. % own to delimit the rest of the line, and then take it out again if we
  577. % didn't need it.
  578. \def\set{\parsearg\setxxx}
  579. \def\setxxx#1{\setyyy#1 \endsetyyy}
  580. \def\setyyy#1 #2\endsetyyy{%
  581.   \def\temp{#2}%
  582.   \ifx\temp\empty \global\expandafter\let\csname SET#1\endcsname = \empty
  583.   \else \setzzz{#1}#2\endsetzzz % Remove the trailing space \setxxx inserted.
  584.   \fi
  585. \def\setzzz#1#2 \endsetzzz{\expandafter\xdef\csname SET#1\endcsname{#2}}
  586. % @clear VAR clears (i.e., unsets) the variable VAR.
  587. \def\clear{\parsearg\clearxxx}
  588. \def\clearxxx#1{\global\expandafter\let\csname SET#1\endcsname=\relax}
  589. % @value{foo} gets the text saved in variable foo.
  590. \def\value#1{\expandafter
  591.         \ifx\csname SET#1\endcsname\relax
  592.             {\{No value for ``#1''\}}
  593.         \else \csname SET#1\endcsname \fi}
  594. % @ifset VAR ... @end ifset reads the `...' iff VAR has been defined
  595. % with @set.
  596. \def\ifset{\parsearg\ifsetxxx}
  597. \def\ifsetxxx #1{%
  598.   \expandafter\ifx\csname SET#1\endcsname\relax
  599.     \expandafter\ifsetfail
  600.   \else
  601.     \expandafter\ifsetsucceed
  602.   \fi
  603. \def\ifsetsucceed{\conditionalsucceed{ifset}}
  604. \def\ifsetfail{\nestedignore{ifset}}
  605. \defineunmatchedend{ifset}
  606. % @ifclear VAR ... @end ifclear reads the `...' iff VAR has never been
  607. % defined with @set, or has been undefined with @clear.
  608. \def\ifclear{\parsearg\ifclearxxx}
  609. \def\ifclearxxx #1{%
  610.   \expandafter\ifx\csname SET#1\endcsname\relax
  611.     \expandafter\ifclearsucceed
  612.   \else
  613.     \expandafter\ifclearfail
  614.   \fi
  615. \def\ifclearsucceed{\conditionalsucceed{ifclear}}
  616. \def\ifclearfail{\nestedignore{ifclear}}
  617. \defineunmatchedend{ifclear}
  618. % @iftex always succeeds; we read the text following, through @end
  619. % iftex).  But `@end iftex' should be valid only after an @iftex.
  620. \def\iftex{\conditionalsucceed{iftex}}
  621. \defineunmatchedend{iftex}
  622. % We can't just want to start a group at @iftex (for example) and end it
  623. % at @end iftex, since then @set commands inside the conditional have no
  624. % effect (they'd get reverted at the end of the group).  So we must
  625. % define \Eiftex to redefine itself to be its previous value.  (We can't
  626. % just define it to fail again with an ``unmatched end'' error, since
  627. % the @ifset might be nested.)
  628. \def\conditionalsucceed#1{%
  629.   \edef\temp{%
  630.     % Remember the current value of \E#1.
  631.     \let\nece{prevE#1} = \nece{E#1}%
  632.     %
  633.     % At the `@end #1', redefine \E#1 to be its previous value.
  634.     \def\nece{E#1}{\let\nece{E#1} = \nece{prevE#1}}%
  635.   \temp
  636. % We need to expand lots of \csname's, but we don't want to expand the
  637. % control sequences after we've constructed them.
  638. \def\nece#1{\expandafter\noexpand\csname#1\endcsname}
  639. % @asis just yields its argument.  Used with @table, for example.
  640. \def\asis#1{#1}
  641. % @math means output in math mode.
  642. % We don't use $'s directly in the definition of \math because control
  643. % sequences like \math are expanded when the toc file is written.  Then,
  644. % we read the toc file back, the $'s will be normal characters (as they
  645. % should be, according to the definition of Texinfo).  So we must use a
  646. % control sequence to switch into and out of math mode.
  647. % This isn't quite enough for @math to work properly in indices, but it
  648. % seems unlikely it will ever be needed there.
  649. \let\implicitmath = $
  650. \def\math#1{\implicitmath #1\implicitmath}
  651. % @bullet and @minus need the same treatment as @math, just above.
  652. \def\bullet{\implicitmath\ptexbullet\implicitmath}
  653. \def\minus{\implicitmath-\implicitmath}
  654. \def\node{\ENVcheck\parsearg\nodezzz}
  655. \def\nodezzz#1{\nodexxx [#1,]}
  656. \def\nodexxx[#1,#2]{\gdef\lastnode{#1}}
  657. \let\nwnode=\node
  658. \let\lastnode=\relax
  659. \def\donoderef{\ifx\lastnode\relax\else
  660. \expandafter\expandafter\expandafter\setref{\lastnode}\fi
  661. \let\lastnode=\relax}
  662. \def\unnumbnoderef{\ifx\lastnode\relax\else
  663. \expandafter\expandafter\expandafter\unnumbsetref{\lastnode}\fi
  664. \let\lastnode=\relax}
  665. \def\appendixnoderef{\ifx\lastnode\relax\else
  666. \expandafter\expandafter\expandafter\appendixsetref{\lastnode}\fi
  667. \let\lastnode=\relax}
  668. \let\refill=\relax
  669. % @setfilename is done at the beginning of every texinfo file.
  670. % So open here the files we need to have open while reading the input.
  671. % This makes it possible to make a .fmt file for texinfo.
  672. \def\setfilename{%
  673.    \readauxfile
  674.    \opencontents
  675.    \openindices
  676.    \fixbackslash  % Turn off hack to swallow `\input texinfo'.
  677.    \global\let\setfilename=\comment % Ignore extra @setfilename cmds.
  678.    \comment % Ignore the actual filename.
  679. \outer\def\bye{\pagealignmacro\tracingstats=1\ptexend}
  680. \def\inforef #1{\inforefzzz #1,,,,**}
  681. \def\inforefzzz #1,#2,#3,#4**{\putwordSee{} \putwordInfo{} \putwordfile{} \file{\ignorespaces #3{}},
  682.   node \samp{\ignorespaces#1{}}}
  683. \message{fonts,}
  684. % Font-change commands.
  685. % Texinfo supports the sans serif font style, which plain TeX does not.
  686. % So we set up a \sf analogous to plain's \rm, etc.
  687. \newfam\sffam
  688. \def\sf{\fam=\sffam \tensf}
  689. \let\li = \sf % Sometimes we call it \li, not \sf.
  690. %% Try out Computer Modern fonts at \magstephalf
  691. \let\mainmagstep=\magstephalf
  692. \ifx\bigger\relax
  693. \let\mainmagstep=\magstep1
  694. \font\textrm=cmr12
  695. \font\texttt=cmtt12
  696. \else
  697. \font\textrm=cmr10 scaled \mainmagstep
  698. \font\texttt=cmtt10 scaled \mainmagstep
  699. % Instead of cmb10, you many want to use cmbx10.
  700. % cmbx10 is a prettier font on its own, but cmb10
  701. % looks better when embedded in a line with cmr10.
  702. \font\textbf=cmb10 scaled \mainmagstep
  703. \font\textit=cmti10 scaled \mainmagstep
  704. \font\textsl=cmsl10 scaled \mainmagstep
  705. \font\textsf=cmss10 scaled \mainmagstep
  706. \font\textsc=cmcsc10 scaled \mainmagstep
  707. \font\texti=cmmi10 scaled \mainmagstep
  708. \font\textsy=cmsy10 scaled \mainmagstep
  709. % A few fonts for @defun, etc.
  710. \font\defbf=cmbx10 scaled \magstep1 %was 1314
  711. \font\deftt=cmtt10 scaled \magstep1
  712. \def\df{\let\tentt=\deftt \let\tenbf = \defbf \bf}
  713. % Fonts for indices and small examples.
  714. % We actually use the slanted font rather than the italic,
  715. % because texinfo normally uses the slanted fonts for that.
  716. % Do not make many font distinctions in general in the index, since they
  717. % aren't very useful.
  718. \font\ninett=cmtt9
  719. \font\indrm=cmr9
  720. \font\indit=cmsl9
  721. \let\indsl=\indit
  722. \let\indtt=\ninett
  723. \let\indsf=\indrm
  724. \let\indbf=\indrm
  725. \let\indsc=\indrm
  726. \font\indi=cmmi9
  727. \font\indsy=cmsy9
  728. % Fonts for headings
  729. \font\chaprm=cmbx12 scaled \magstep2
  730. \font\chapit=cmti12 scaled \magstep2
  731. \font\chapsl=cmsl12 scaled \magstep2
  732. \font\chaptt=cmtt12 scaled \magstep2
  733. \font\chapsf=cmss12 scaled \magstep2
  734. \let\chapbf=\chaprm
  735. \font\chapsc=cmcsc10 scaled\magstep3
  736. \font\chapi=cmmi12 scaled \magstep2
  737. \font\chapsy=cmsy10 scaled \magstep3
  738. \font\secrm=cmbx12 scaled \magstep1
  739. \font\secit=cmti12 scaled \magstep1
  740. \font\secsl=cmsl12 scaled \magstep1
  741. \font\sectt=cmtt12 scaled \magstep1
  742. \font\secsf=cmss12 scaled \magstep1
  743. \font\secbf=cmbx12 scaled \magstep1
  744. \font\secsc=cmcsc10 scaled\magstep2
  745. \font\seci=cmmi12 scaled \magstep1
  746. \font\secsy=cmsy10 scaled \magstep2
  747. % \font\ssecrm=cmbx10 scaled \magstep1    % This size an font looked bad.
  748. % \font\ssecit=cmti10 scaled \magstep1    % The letters were too crowded.
  749. % \font\ssecsl=cmsl10 scaled \magstep1
  750. % \font\ssectt=cmtt10 scaled \magstep1
  751. % \font\ssecsf=cmss10 scaled \magstep1
  752. %\font\ssecrm=cmb10 scaled 1315    % Note the use of cmb rather than cmbx.
  753. %\font\ssecit=cmti10 scaled 1315    % Also, the size is a little larger than
  754. %\font\ssecsl=cmsl10 scaled 1315    % being scaled magstep1.
  755. %\font\ssectt=cmtt10 scaled 1315
  756. %\font\ssecsf=cmss10 scaled 1315
  757. %\let\ssecbf=\ssecrm
  758. \font\ssecrm=cmbx12 scaled \magstephalf
  759. \font\ssecit=cmti12 scaled \magstephalf
  760. \font\ssecsl=cmsl12 scaled \magstephalf
  761. \font\ssectt=cmtt12 scaled \magstephalf
  762. \font\ssecsf=cmss12 scaled \magstephalf
  763. \font\ssecbf=cmbx12 scaled \magstephalf
  764. \font\ssecsc=cmcsc10 scaled \magstep1
  765. \font\sseci=cmmi12 scaled \magstephalf
  766. \font\ssecsy=cmsy10 scaled \magstep1
  767. % The smallcaps and symbol fonts should actually be scaled \magstep1.5,
  768. % but that is not a standard magnification.
  769. % Fonts for title page:
  770. \font\titlerm = cmbx12 scaled \magstep3
  771. \let\authorrm = \secrm
  772. % In order for the font changes to affect most math symbols and letters,
  773. % we have to define the \textfont of the standard families.  Since
  774. % texinfo doesn't allow for producing subscripts and superscripts, we
  775. % don't bother to reset \scriptfont and \scriptscriptfont (which would
  776. % also require loading a lot more fonts).
  777. \def\resetmathfonts{%
  778.   \textfont0 = \tenrm \textfont1 = \teni \textfont2 = \tensy
  779.   \textfont\itfam = \tenit \textfont\slfam = \tensl \textfont\bffam = \tenbf
  780.   \textfont\ttfam = \tentt \textfont\sffam = \tensf
  781. % The font-changing commands redefine the meanings of \tenSTYLE, instead
  782. % of just \STYLE.  We do this so that font changes will continue to work
  783. % in math mode, where it is the current \fam that is relevant in most
  784. % cases, not the current.  Plain TeX does, for example,
  785. % \def\bf{\fam=\bffam \tenbf}  By redefining \tenbf, we obviate the need
  786. % to redefine \bf itself.
  787. \def\textfonts{%
  788.   \let\tenrm=\textrm \let\tenit=\textit \let\tensl=\textsl
  789.   \let\tenbf=\textbf \let\tentt=\texttt \let\smallcaps=\textsc
  790.   \let\tensf=\textsf \let\teni=\texti \let\tensy=\textsy
  791.   \resetmathfonts}
  792. \def\chapfonts{%
  793.   \let\tenrm=\chaprm \let\tenit=\chapit \let\tensl=\chapsl
  794.   \let\tenbf=\chapbf \let\tentt=\chaptt \let\smallcaps=\chapsc
  795.   \let\tensf=\chapsf \let\teni=\chapi \let\tensy=\chapsy
  796.   \resetmathfonts}
  797. \def\secfonts{%
  798.   \let\tenrm=\secrm \let\tenit=\secit \let\tensl=\secsl
  799.   \let\tenbf=\secbf \let\tentt=\sectt \let\smallcaps=\secsc
  800.   \let\tensf=\secsf \let\teni=\seci \let\tensy=\secsy
  801.   \resetmathfonts}
  802. \def\subsecfonts{%
  803.   \let\tenrm=\ssecrm \let\tenit=\ssecit \let\tensl=\ssecsl
  804.   \let\tenbf=\ssecbf \let\tentt=\ssectt \let\smallcaps=\ssecsc
  805.   \let\tensf=\ssecsf \let\teni=\sseci \let\tensy=\ssecsy
  806.   \resetmathfonts}
  807. \def\indexfonts{%
  808.   \let\tenrm=\indrm \let\tenit=\indit \let\tensl=\indsl
  809.   \let\tenbf=\indbf \let\tentt=\indtt \let\smallcaps=\indsc
  810.   \let\tensf=\indsf \let\teni=\indi \let\tensy=\indsy
  811.   \resetmathfonts}
  812. % Set up the default fonts, so we can use them for creating boxes.
  813. \textfonts
  814. % Count depth in font-changes, for error checks
  815. \newcount\fontdepth \fontdepth=0
  816. % Fonts for short table of contents.
  817. \font\shortcontrm=cmr12
  818. \font\shortcontbf=cmbx12
  819. \font\shortcontsl=cmsl12
  820. %% Add scribe-like font environments, plus @l for inline lisp (usually sans
  821. %% serif) and @ii for TeX italic
  822. % \smartitalic{ARG} outputs arg in italics, followed by an italic correction
  823. % unless the following character is such as not to need one.
  824. \def\smartitalicx{\ifx\next,\else\ifx\next-\else\ifx\next.\else\/\fi\fi\fi}
  825. \def\smartitalic#1{{\sl #1}\futurelet\next\smartitalicx}
  826. \let\i=\smartitalic
  827. \let\var=\smartitalic
  828. \let\dfn=\smartitalic
  829. \let\emph=\smartitalic
  830. \let\cite=\smartitalic
  831. \def\b#1{{\bf #1}}
  832. \let\strong=\b
  833. % We can't just use \exhyphenpenalty, because that only has effect at
  834. % the end of a paragraph.  Restore normal hyphenation at the end of the
  835. % group within which \nohyphenation is presumably called.
  836. \def\nohyphenation{\hyphenchar\font = -1  \aftergroup\restorehyphenation}
  837. \def\restorehyphenation{\hyphenchar\font = `- }
  838. \def\t#1{%
  839.   {\tt \nohyphenation \rawbackslash \frenchspacing #1}%
  840.   \null
  841. \let\ttfont = \t
  842. %\def\samp #1{`{\tt \rawbackslash \frenchspacing #1}'\null}
  843. \def\samp #1{`\tclose{#1}'\null}
  844. \def\key #1{{\tt \nohyphenation \uppercase{#1}}\null}
  845. \def\ctrl #1{{\tt \rawbackslash \hat}#1}
  846. \let\file=\samp
  847. % @code is a modification of @t,
  848. % which makes spaces the same size as normal in the surrounding text.
  849. \def\tclose#1{%
  850.     % Change normal interword space to be same as for the current font.
  851.     \spaceskip = \fontdimen2\font
  852.     %
  853.     % Switch to typewriter.
  854.     \tt
  855.     %
  856.     % But `\ ' produces the large typewriter interword space.
  857.     \def\ {{\spaceskip = 0pt{} }}%
  858.     %
  859.     % Turn off hyphenation.
  860.     \nohyphenation
  861.     %
  862.     \rawbackslash
  863.     \frenchspacing
  864.     #1%
  865.   \null
  866. % We *must* turn on hyphenation at `-' and `_' in \code.
  867. % Otherwise, it is too hard to avoid overful hboxes
  868. % in the Emacs manual, the Library manual, etc.
  869. % Unfortunately, TeX uses one parameter (\hyphenchar) to control
  870. % both hyphenation at - and hyphenation within words.
  871. % We must therefore turn them both off (\tclose does that)
  872. % and arrange explicitly to hyphenate an a dash.
  873. %  -- rms.
  874. \catcode`\-=\active
  875. \catcode`\_=\active
  876. \global\def\code{\begingroup \catcode`\-=\active \let-\codedash \catcode`\_=\active \let_\codeunder \codex}
  877. % The following is used by \doprintindex to insure that long function names
  878. % wrap around.  It is necessary for - and _ to be active before the index is
  879. % read from the file, as \entry parses the arguments long before \code is
  880. % ever called.  -- mycroft
  881. \global\def\indexbreaks{\catcode`\-=\active \let-\realdash \catcode`\_=\active \let_\realunder}
  882. \def\realdash{-}
  883. \def\realunder{_}
  884. \def\codedash{-\discretionary{}{}{}}
  885. \def\codeunder{\normalunderscore\discretionary{}{}{}}
  886. \def\codex #1{\tclose{#1}\endgroup}
  887. %\let\exp=\tclose  %Was temporary
  888. % @kbd is like @code, except that if the argument is just one @key command,
  889. % then @kbd has no effect.
  890. \def\xkey{\key}
  891. \def\kbdfoo#1#2#3\par{\def\one{#1}\def\three{#3}\def\threex{??}%
  892. \ifx\one\xkey\ifx\threex\three \key{#2}%
  893. \else\tclose{\look}\fi
  894. \else\tclose{\look}\fi}
  895. % Typeset a dimension, e.g., `in' or `pt'.  The only reason for the
  896. % argument is to make the input look right: @dmn{pt} instead of
  897. % @dmn{}pt.
  898. \def\dmn#1{\thinspace #1}
  899. \def\kbd#1{\def\look{#1}\expandafter\kbdfoo\look??\par}
  900. \def\l#1{{\li #1}\null}        %
  901. \def\r#1{{\rm #1}}        % roman font
  902. % Use of \lowercase was suggested.
  903. \def\sc#1{{\smallcaps#1}}    % smallcaps font
  904. \def\ii#1{{\it #1}}        % italic font
  905. \message{page headings,}
  906. \newskip\titlepagetopglue \titlepagetopglue = 1.5in
  907. \newskip\titlepagebottomglue \titlepagebottomglue = 2pc
  908. % First the title page.  Must do @settitle before @titlepage.
  909. \def\titlefont#1{{\titlerm #1}}
  910. \newif\ifseenauthor
  911. \newif\iffinishedtitlepage
  912. \def\shorttitlepage{\parsearg\shorttitlepagezzz}
  913. \def\shorttitlepagezzz #1{\begingroup\hbox{}\vskip 1.5in \chaprm \centerline{#1}%
  914.     \endgroup\page\hbox{}\page}
  915. \def\titlepage{\begingroup \parindent=0pt \textfonts
  916.    \let\subtitlerm=\tenrm
  917. % I deinstalled the following change because \cmr12 is undefined.
  918. % This change was not in the ChangeLog anyway.  --rms.
  919. %   \let\subtitlerm=\cmr12
  920.    \def\subtitlefont{\subtitlerm \normalbaselineskip = 13pt \normalbaselines}%
  921.    \def\authorfont{\authorrm \normalbaselineskip = 16pt \normalbaselines}%
  922.    % Leave some space at the very top of the page.
  923.    \vglue\titlepagetopglue
  924.    % Now you can print the title using @title.
  925.    \def\title{\parsearg\titlezzz}%
  926.    \def\titlezzz##1{\leftline{\titlefont{##1}}
  927.             % print a rule at the page bottom also.
  928.             \finishedtitlepagefalse
  929.             \vskip4pt \hrule height 4pt width \hsize \vskip4pt}%
  930.    % No rule at page bottom unless we print one at the top with @title.
  931.    \finishedtitlepagetrue
  932.    % Now you can put text using @subtitle.
  933.    \def\subtitle{\parsearg\subtitlezzz}%
  934.    \def\subtitlezzz##1{{\subtitlefont \rightline{##1}}}%
  935.    % @author should come last, but may come many times.
  936.    \def\author{\parsearg\authorzzz}%
  937.    \def\authorzzz##1{\ifseenauthor\else\vskip 0pt plus 1filll\seenauthortrue\fi
  938.       {\authorfont \leftline{##1}}}%
  939.    % Most title ``pages'' are actually two pages long, with space
  940.    % at the top of the second.  We don't want the ragged left on the second.
  941.    \let\oldpage = \page
  942.    \def\page{%
  943.       \iffinishedtitlepage\else
  944.      \finishtitlepage
  945.       \fi
  946.       \oldpage
  947.       \let\page = \oldpage
  948.       \hbox{}}%
  949. %   \def\page{\oldpage \hbox{}}
  950. \def\Etitlepage{%
  951.    \iffinishedtitlepage\else
  952.       \finishtitlepage
  953.    \fi
  954.    % It is important to do the page break before ending the group,
  955.    % because the headline and footline are only empty inside the group.
  956.    % If we use the new definition of \page, we always get a blank page
  957.    % after the title page, which we certainly don't want.
  958.    \oldpage
  959.    \endgroup
  960.    \HEADINGSon
  961. \def\finishtitlepage{%
  962.    \vskip4pt \hrule height 2pt width \hsize
  963.    \vskip\titlepagebottomglue
  964.    \finishedtitlepagetrue
  965. %%% Set up page headings and footings.
  966. \let\thispage=\folio
  967. \newtoks \evenheadline    % Token sequence for heading line of even pages
  968. \newtoks \oddheadline     % Token sequence for heading line of odd pages
  969. \newtoks \evenfootline    % Token sequence for footing line of even pages
  970. \newtoks \oddfootline     % Token sequence for footing line of odd pages
  971. % Now make Tex use those variables
  972. \headline={{\textfonts\rm \ifodd\pageno \the\oddheadline
  973.                             \else \the\evenheadline \fi}}
  974. \footline={{\textfonts\rm \ifodd\pageno \the\oddfootline
  975.                             \else \the\evenfootline \fi}\HEADINGShook}
  976. \let\HEADINGShook=\relax
  977. % Commands to set those variables.
  978. % For example, this is what  @headings on  does
  979. % @evenheading @thistitle|@thispage|@thischapter
  980. % @oddheading @thischapter|@thispage|@thistitle
  981. % @evenfooting @thisfile||
  982. % @oddfooting ||@thisfile
  983. \def\evenheading{\parsearg\evenheadingxxx}
  984. \def\oddheading{\parsearg\oddheadingxxx}
  985. \def\everyheading{\parsearg\everyheadingxxx}
  986. \def\evenfooting{\parsearg\evenfootingxxx}
  987. \def\oddfooting{\parsearg\oddfootingxxx}
  988. \def\everyfooting{\parsearg\everyfootingxxx}
  989. {\catcode`\@=0 %
  990. \gdef\evenheadingxxx #1{\evenheadingyyy #1@|@|@|@|\finish}
  991. \gdef\evenheadingyyy #1@|#2@|#3@|#4\finish{%
  992. \global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
  993. \gdef\oddheadingxxx #1{\oddheadingyyy #1@|@|@|@|\finish}
  994. \gdef\oddheadingyyy #1@|#2@|#3@|#4\finish{%
  995. \global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
  996. \gdef\everyheadingxxx #1{\everyheadingyyy #1@|@|@|@|\finish}
  997. \gdef\everyheadingyyy #1@|#2@|#3@|#4\finish{%
  998. \global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}
  999. \global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
  1000. \gdef\evenfootingxxx #1{\evenfootingyyy #1@|@|@|@|\finish}
  1001. \gdef\evenfootingyyy #1@|#2@|#3@|#4\finish{%
  1002. \global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
  1003. \gdef\oddfootingxxx #1{\oddfootingyyy #1@|@|@|@|\finish}
  1004. \gdef\oddfootingyyy #1@|#2@|#3@|#4\finish{%
  1005. \global\oddfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
  1006. \gdef\everyfootingxxx #1{\everyfootingyyy #1@|@|@|@|\finish}
  1007. \gdef\everyfootingyyy #1@|#2@|#3@|#4\finish{%
  1008. \global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}
  1009. \global\oddfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
  1010. }% unbind the catcode of @.
  1011. % @headings double    turns headings on for double-sided printing.
  1012. % @headings single    turns headings on for single-sided printing.
  1013. % @headings off        turns them off.
  1014. % @headings on        same as @headings double, retained for compatibility.
  1015. % @headings after    turns on double-sided headings after this page.
  1016. % @headings doubleafter    turns on double-sided headings after this page.
  1017. % @headings singleafter turns on single-sided headings after this page.
  1018. % By default, they are off.
  1019. \def\headings #1 {\csname HEADINGS#1\endcsname}
  1020. \def\HEADINGSoff{
  1021. \global\evenheadline={\hfil} \global\evenfootline={\hfil}
  1022. \global\oddheadline={\hfil} \global\oddfootline={\hfil}}
  1023. \HEADINGSoff
  1024. % When we turn headings on, set the page number to 1.
  1025. % For double-sided printing, put current file name in lower left corner,
  1026. % chapter name on inside top of right hand pages, document
  1027. % title on inside top of left hand pages, and page numbers on outside top
  1028. % edge of all pages.
  1029. \def\HEADINGSdouble{
  1030. %\pagealignmacro
  1031. \global\pageno=1
  1032. \global\evenfootline={\hfil}
  1033. \global\oddfootline={\hfil}
  1034. \global\evenheadline={\line{\folio\hfil\thistitle}}
  1035. \global\oddheadline={\line{\thischapter\hfil\folio}}
  1036. % For single-sided printing, chapter title goes across top left of page,
  1037. % page number on top right.
  1038. \def\HEADINGSsingle{
  1039. %\pagealignmacro
  1040. \global\pageno=1
  1041. \global\evenfootline={\hfil}
  1042. \global\oddfootline={\hfil}
  1043. \global\evenheadline={\line{\thischapter\hfil\folio}}
  1044. \global\oddheadline={\line{\thischapter\hfil\folio}}
  1045. \def\HEADINGSon{\HEADINGSdouble}
  1046. \def\HEADINGSafter{\let\HEADINGShook=\HEADINGSdoublex}
  1047. \let\HEADINGSdoubleafter=\HEADINGSafter
  1048. \def\HEADINGSdoublex{%
  1049. \global\evenfootline={\hfil}
  1050. \global\oddfootline={\hfil}
  1051. \global\evenheadline={\line{\folio\hfil\thistitle}}
  1052. \global\oddheadline={\line{\thischapter\hfil\folio}}
  1053. \def\HEADINGSsingleafter{\let\HEADINGShook=\HEADINGSsinglex}
  1054. \def\HEADINGSsinglex{%
  1055. \global\evenfootline={\hfil}
  1056. \global\oddfootline={\hfil}
  1057. \global\evenheadline={\line{\thischapter\hfil\folio}}
  1058. \global\oddheadline={\line{\thischapter\hfil\folio}}
  1059. % Subroutines used in generating headings
  1060. % Produces Day Month Year style of output.
  1061. \def\today{\number\day\space
  1062. \ifcase\month\or
  1063. January\or February\or March\or April\or May\or June\or
  1064. July\or August\or September\or October\or November\or December\fi
  1065. \space\number\year}
  1066. % Use this if you want the Month Day, Year style of output.
  1067. %\def\today{\ifcase\month\or
  1068. %January\or February\or March\or April\or May\or June\or
  1069. %July\or August\or September\or October\or November\or December\fi
  1070. %\space\number\day, \number\year}
  1071. % @settitle line...  specifies the title of the document, for headings
  1072. % It generates no output of its own
  1073. \def\thistitle{No Title}
  1074. \def\settitle{\parsearg\settitlezzz}
  1075. \def\settitlezzz #1{\gdef\thistitle{#1}}
  1076. \message{tables,}
  1077. % @tabs -- simple alignment
  1078. % These don't work.  For one thing, \+ is defined as outer.
  1079. % So these macros cannot even be defined.
  1080. %\def\tabs{\parsearg\tabszzz}
  1081. %\def\tabszzz #1{\settabs\+#1\cr}
  1082. %\def\tabline{\parsearg\tablinezzz}
  1083. %\def\tablinezzz #1{\+#1\cr}
  1084. %\def\&{&}
  1085. % Tables -- @table, @ftable, @vtable, @item(x), @kitem(x), @xitem(x).
  1086. % default indentation of table text
  1087. \newdimen\tableindent \tableindent=.8in
  1088. % default indentation of @itemize and @enumerate text
  1089. \newdimen\itemindent  \itemindent=.3in
  1090. % margin between end of table item and start of table text.
  1091. \newdimen\itemmargin  \itemmargin=.1in
  1092. % used internally for \itemindent minus \itemmargin
  1093. \newdimen\itemmax
  1094. % Note @table, @vtable, and @vtable define @item, @itemx, etc., with
  1095. % these defs.
  1096. % They also define \itemindex
  1097. % to index the item name in whatever manner is desired (perhaps none).
  1098. \newif\ifitemxneedsnegativevskip
  1099. \def\itemxpar{\par\ifitemxneedsnegativevskip\vskip-\parskip\nobreak\fi}
  1100. \def\internalBitem{\smallbreak \parsearg\itemzzz}
  1101. \def\internalBitemx{\itemxpar \parsearg\itemzzz}
  1102. \def\internalBxitem "#1"{\def\xitemsubtopix{#1} \smallbreak \parsearg\xitemzzz}
  1103. \def\internalBxitemx "#1"{\def\xitemsubtopix{#1} \itemxpar \parsearg\xitemzzz}
  1104. \def\internalBkitem{\smallbreak \parsearg\kitemzzz}
  1105. \def\internalBkitemx{\itemxpar \parsearg\kitemzzz}
  1106. \def\kitemzzz #1{\dosubind {kw}{\code{#1}}{for {\bf \lastfunction}}%
  1107.                  \itemzzz {#1}}
  1108. \def\xitemzzz #1{\dosubind {kw}{\code{#1}}{for {\bf \xitemsubtopic}}%
  1109.                  \itemzzz {#1}}
  1110. \def\itemzzz #1{\begingroup %
  1111.   \advance\hsize by -\rightskip
  1112.   \advance\hsize by -\tableindent
  1113.   \setbox0=\hbox{\itemfont{#1}}%
  1114.   \itemindex{#1}%
  1115.   \nobreak % This prevents a break before @itemx.
  1116.   % Be sure we are not still in the middle of a paragraph.
  1117.   %{\parskip = 0in
  1118.   %\par
  1119.   %}%
  1120.   % If the item text does not fit in the space we have, put it on a line
  1121.   % by itself, and do not allow a page break either before or after that
  1122.   % line.  We do not start a paragraph here because then if the next
  1123.   % command is, e.g., @kindex, the whatsit would get put into the
  1124.   % horizontal list on a line by itself, resulting in extra blank space.
  1125.   \ifdim \wd0>\itemmax
  1126.     %
  1127.     % Make this a paragraph so we get the \parskip glue and wrapping,
  1128.     % but leave it ragged-right.
  1129.     \begingroup
  1130.       \advance\leftskip by-\tableindent
  1131.       \advance\hsize by\tableindent
  1132.       \advance\rightskip by0pt plus1fil
  1133.       \leavevmode\unhbox0\par
  1134.     \endgroup
  1135.     %
  1136.     % We're going to be starting a paragraph, but we don't want the
  1137.     % \parskip glue -- logically it's part of the @item we just started.
  1138.     \nobreak \vskip-\parskip
  1139.     %
  1140.     % Stop a page break at the \parskip glue coming up.  Unfortunately
  1141.     % we can't prevent a possible page break at the following
  1142.     % \baselineskip glue.
  1143.     \nobreak
  1144.     \endgroup
  1145.     \itemxneedsnegativevskipfalse
  1146.   \else
  1147.     % The item text fits into the space.  Start a paragraph, so that the
  1148.     % following text (if any) will end up on the same line.  Since that
  1149.     % text will be indented by \tableindent, we make the item text be in
  1150.     % a zero-width box.
  1151.     \noindent
  1152.     \rlap{\hskip -\tableindent\box0}\ignorespaces%
  1153.     \endgroup%
  1154.     \itemxneedsnegativevskiptrue%
  1155.   \fi
  1156. \def\item{\errmessage{@item while not in a table}}
  1157. \def\itemx{\errmessage{@itemx while not in a table}}
  1158. \def\kitem{\errmessage{@kitem while not in a table}}
  1159. \def\kitemx{\errmessage{@kitemx while not in a table}}
  1160. \def\xitem{\errmessage{@xitem while not in a table}}
  1161. \def\xitemx{\errmessage{@xitemx while not in a table}}
  1162. %% Contains a kludge to get @end[description] to work
  1163. \def\description{\tablez{\dontindex}{1}{}{}{}{}}
  1164. \def\table{\begingroup\inENV\obeylines\obeyspaces\tablex}
  1165. {\obeylines\obeyspaces%
  1166. \gdef\tablex #1^^M{%
  1167. \tabley\dontindex#1        \endtabley}}
  1168. \def\ftable{\begingroup\inENV\obeylines\obeyspaces\ftablex}
  1169. {\obeylines\obeyspaces%
  1170. \gdef\ftablex #1^^M{%
  1171. \tabley\fnitemindex#1        \endtabley
  1172. \def\Eftable{\endgraf\afterenvbreak\endgroup}%
  1173. \let\Etable=\relax}}
  1174. \def\vtable{\begingroup\inENV\obeylines\obeyspaces\vtablex}
  1175. {\obeylines\obeyspaces%
  1176. \gdef\vtablex #1^^M{%
  1177. \tabley\vritemindex#1        \endtabley
  1178. \def\Evtable{\endgraf\afterenvbreak\endgroup}%
  1179. \let\Etable=\relax}}
  1180. \def\dontindex #1{}
  1181. \def\fnitemindex #1{\doind {fn}{\code{#1}}}%
  1182. \def\vritemindex #1{\doind {vr}{\code{#1}}}%
  1183. {\obeyspaces %
  1184. \gdef\tabley#1#2 #3 #4 #5 #6 #7\endtabley{\endgroup%
  1185. \tablez{#1}{#2}{#3}{#4}{#5}{#6}}}
  1186. \def\tablez #1#2#3#4#5#6{%
  1187. \aboveenvbreak %
  1188. \begingroup %
  1189. \def\Edescription{\Etable}% Neccessary kludge.
  1190. \let\itemindex=#1%
  1191. \ifnum 0#3>0 \advance \leftskip by #3\mil \fi %
  1192. \ifnum 0#4>0 \tableindent=#4\mil \fi %
  1193. \ifnum 0#5>0 \advance \rightskip by #5\mil \fi %
  1194. \def\itemfont{#2}%
  1195. \itemmax=\tableindent %
  1196. \advance \itemmax by -\itemmargin %
  1197. \advance \leftskip by \tableindent %
  1198. \exdentamount=\tableindent
  1199. \parindent = 0pt
  1200. \parskip = \smallskipamount
  1201. \ifdim \parskip=0pt \parskip=2pt \fi%
  1202. \def\Etable{\endgraf\afterenvbreak\endgroup}%
  1203. \let\item = \internalBitem %
  1204. \let\itemx = \internalBitemx %
  1205. \let\kitem = \internalBkitem %
  1206. \let\kitemx = \internalBkitemx %
  1207. \let\xitem = \internalBxitem %
  1208. \let\xitemx = \internalBxitemx %
  1209. % This is the counter used by @enumerate, which is really @itemize
  1210. \newcount \itemno
  1211. \def\itemize{\parsearg\itemizezzz}
  1212. \def\itemizezzz #1{%
  1213.   \begingroup % ended by the @end itemsize
  1214.   \itemizey {#1}{\Eitemize}
  1215. \def\itemizey #1#2{%
  1216. \aboveenvbreak %
  1217. \itemmax=\itemindent %
  1218. \advance \itemmax by -\itemmargin %
  1219. \advance \leftskip by \itemindent %
  1220. \exdentamount=\itemindent
  1221. \parindent = 0pt %
  1222. \parskip = \smallskipamount %
  1223. \ifdim \parskip=0pt \parskip=2pt \fi%
  1224. \def#2{\endgraf\afterenvbreak\endgroup}%
  1225. \def\itemcontents{#1}%
  1226. \let\item=\itemizeitem}
  1227. % Set sfcode to normal for the chars that usually have another value.
  1228. % These are `.?!:;,'
  1229. \def\frenchspacing{\sfcode46=1000 \sfcode63=1000 \sfcode33=1000
  1230.   \sfcode58=1000 \sfcode59=1000 \sfcode44=1000 }
  1231. % \splitoff TOKENS\endmark defines \first to be the first token in
  1232. % TOKENS, and \rest to be the remainder.
  1233. \def\splitoff#1#2\endmark{\def\first{#1}\def\rest{#2}}%
  1234. % Allow an optional argument of an uppercase letter, lowercase letter,
  1235. % or number, to specify the first label in the enumerated list.  No
  1236. % argument is the same as `1'.
  1237. \def\enumerate{\parsearg\enumeratezzz}
  1238. \def\enumeratezzz #1{\enumeratey #1  \endenumeratey}
  1239. \def\enumeratey #1 #2\endenumeratey{%
  1240.   \begingroup % ended by the @end enumerate
  1241.   % If we were given no argument, pretend we were given `1'.
  1242.   \def\thearg{#1}%
  1243.   \ifx\thearg\empty \def\thearg{1}\fi
  1244.   % Detect if the argument is a single token.  If so, it might be a
  1245.   % letter.  Otherwise, the only valid thing it can be is a number.
  1246.   % (We will always have one token, because of the test we just made.
  1247.   % This is a good thing, since \splitoff doesn't work given nothing at
  1248.   % all -- the first parameter is undelimited.)
  1249.   \expandafter\splitoff\thearg\endmark
  1250.   \ifx\rest\empty
  1251.     % Only one token in the argument.  It could still be anything.
  1252.     % A ``lowercase letter'' is one whose \lccode is nonzero.
  1253.     % An ``uppercase letter'' is one whose \lccode is both nonzero, and
  1254.     %   not equal to itself.
  1255.     % Otherwise, we assume it's a number.
  1256.     %
  1257.     % We need the \relax at the end of the \ifnum lines to stop TeX from
  1258.     % continuing to look for a <number>.
  1259.     %
  1260.     \ifnum\lccode\expandafter`\thearg=0\relax
  1261.       \numericenumerate % a number (we hope)
  1262.     \else
  1263.       % It's a letter.
  1264.       \ifnum\lccode\expandafter`\thearg=\expandafter`\thearg\relax
  1265.         \lowercaseenumerate % lowercase letter
  1266.       \else
  1267.         \uppercaseenumerate % uppercase letter
  1268.       \fi
  1269.     \fi
  1270.   \else
  1271.     % Multiple tokens in the argument.  We hope it's a number.
  1272.     \numericenumerate
  1273.   \fi
  1274. % An @enumerate whose labels are integers.  The starting integer is
  1275. % given in \thearg.
  1276. \def\numericenumerate{%
  1277.   \itemno = \thearg
  1278.   \startenumeration{\the\itemno}%
  1279. % The starting (lowercase) letter is in \thearg.
  1280. \def\lowercaseenumerate{%
  1281.   \itemno = \expandafter`\thearg
  1282.   \startenumeration{%
  1283.     % Be sure we're not beyond the end of the alphabet.
  1284.     \ifnum\itemno=0
  1285.       \errmessage{No more lowercase letters in @enumerate; get a bigger
  1286.                   alphabet}%
  1287.     \fi
  1288.     \char\lccode\itemno
  1289. % The starting (uppercase) letter is in \thearg.
  1290. \def\uppercaseenumerate{%
  1291.   \itemno = \expandafter`\thearg
  1292.   \startenumeration{%
  1293.     % Be sure we're not beyond the end of the alphabet.
  1294.     \ifnum\itemno=0
  1295.       \errmessage{No more uppercase letters in @enumerate; get a bigger
  1296.                   alphabet}
  1297.     \fi
  1298.     \char\uccode\itemno
  1299. % Call itemizey, adding a period to the first argument and supplying the
  1300. % common last two arguments.  Also subtract one from the initial value in
  1301. % \itemno, since @item increments \itemno.
  1302. \def\startenumeration#1{%
  1303.   \advance\itemno by -1
  1304.   \itemizey{#1.}\Eenumerate\flushcr
  1305. % @alphaenumerate and @capsenumerate are abbreviations for giving an arg
  1306. % to @enumerate.
  1307. \def\alphaenumerate{\enumerate{a}}
  1308. \def\capsenumerate{\enumerate{A}}
  1309. \def\Ealphaenumerate{\Eenumerate}
  1310. \def\Ecapsenumerate{\Eenumerate}
  1311. % Definition of @item while inside @itemize.
  1312. \def\itemizeitem{%
  1313. \advance\itemno by 1
  1314. {\let\par=\endgraf \smallbreak}%
  1315. \ifhmode \errmessage{\in hmode at itemizeitem}\fi
  1316. {\parskip=0in \hskip 0pt
  1317. \hbox to 0pt{\hss \itemcontents\hskip \itemmargin}%
  1318. \vadjust{\penalty 1200}}%
  1319. \flushcr}
  1320. \message{indexing,}
  1321. % Index generation facilities
  1322. % Define \newwrite to be identical to plain tex's \newwrite
  1323. % except not \outer, so it can be used within \newindex.
  1324. {\catcode`\@=11
  1325. \gdef\newwrite{\alloc@7\write\chardef\sixt@@n}}
  1326. % \newindex {foo} defines an index named foo.
  1327. % It automatically defines \fooindex such that
  1328. % \fooindex ...rest of line... puts an entry in the index foo.
  1329. % It also defines \fooindfile to be the number of the output channel for
  1330. % the file that    accumulates this index.  The file's extension is foo.
  1331. % The name of an index should be no more than 2 characters long
  1332. % for the sake of vms.
  1333. \def\newindex #1{
  1334. \expandafter\newwrite \csname#1indfile\endcsname% Define number for output file
  1335. \openout \csname#1indfile\endcsname \jobname.#1    % Open the file
  1336. \expandafter\xdef\csname#1index\endcsname{%    % Define \xxxindex
  1337. \noexpand\doindex {#1}}
  1338. % @defindex foo  ==  \newindex{foo}
  1339. \def\defindex{\parsearg\newindex}
  1340. % Define @defcodeindex, like @defindex except put all entries in @code.
  1341. \def\newcodeindex #1{
  1342. \expandafter\newwrite \csname#1indfile\endcsname% Define number for output file
  1343. \openout \csname#1indfile\endcsname \jobname.#1    % Open the file
  1344. \expandafter\xdef\csname#1index\endcsname{%    % Define \xxxindex
  1345. \noexpand\docodeindex {#1}}
  1346. \def\defcodeindex{\parsearg\newcodeindex}
  1347. % @synindex foo bar    makes index foo feed into index bar.
  1348. % Do this instead of @defindex foo if you don't want it as a separate index.
  1349. \def\synindex #1 #2 {%
  1350. \expandafter\let\expandafter\synindexfoo\expandafter=\csname#2indfile\endcsname
  1351. \expandafter\let\csname#1indfile\endcsname=\synindexfoo
  1352. \expandafter\xdef\csname#1index\endcsname{%    % Define \xxxindex
  1353. \noexpand\doindex {#2}}%
  1354. % @syncodeindex foo bar   similar, but put all entries made for index foo
  1355. % inside @code.
  1356. \def\syncodeindex #1 #2 {%
  1357. \expandafter\let\expandafter\synindexfoo\expandafter=\csname#2indfile\endcsname
  1358. \expandafter\let\csname#1indfile\endcsname=\synindexfoo
  1359. \expandafter\xdef\csname#1index\endcsname{%    % Define \xxxindex
  1360. \noexpand\docodeindex {#2}}%
  1361. % Define \doindex, the driver for all \fooindex macros.
  1362. % Argument #1 is generated by the calling \fooindex macro,
  1363. %  and it is "foo", the name of the index.
  1364. % \doindex just uses \parsearg; it calls \doind for the actual work.
  1365. % This is because \doind is more useful to call from other macros.
  1366. % There is also \dosubind {index}{topic}{subtopic}
  1367. % which makes an entry in a two-level index such as the operation index.
  1368. \def\doindex#1{\edef\indexname{#1}\parsearg\singleindexer}
  1369. \def\singleindexer #1{\doind{\indexname}{#1}}
  1370. % like the previous two, but they put @code around the argument.
  1371. \def\docodeindex#1{\edef\indexname{#1}\parsearg\singlecodeindexer}
  1372. \def\singlecodeindexer #1{\doind{\indexname}{\code{#1}}}
  1373. \def\indexdummies{%
  1374. % Take care of the plain tex accent commands.
  1375. \def\"{\realbackslash "}%
  1376. \def\`{\realbackslash `}%
  1377. \def\'{\realbackslash '}%
  1378. \def\^{\realbackslash ^}%
  1379. \def\~{\realbackslash ~}%
  1380. \def\={\realbackslash =}%
  1381. \def\b{\realbackslash b}%
  1382. \def\c{\realbackslash c}%
  1383. \def\d{\realbackslash d}%
  1384. \def\u{\realbackslash u}%
  1385. \def\v{\realbackslash v}%
  1386. \def\H{\realbackslash H}%
  1387. % Take care of the plain tex special European modified letters.
  1388. \def\oe{\realbackslash oe}%
  1389. \def\ae{\realbackslash ae}%
  1390. \def\aa{\realbackslash aa}%
  1391. \def\OE{\realbackslash OE}%
  1392. \def\AE{\realbackslash AE}%
  1393. \def\AA{\realbackslash AA}%
  1394. \def\o{\realbackslash o}%
  1395. \def\O{\realbackslash O}%
  1396. \def\l{\realbackslash l}%
  1397. \def\L{\realbackslash L}%
  1398. \def\ss{\realbackslash ss}%
  1399. % Take care of texinfo commands likely to appear in an index entry.
  1400. \def\_{{\realbackslash _}}%
  1401. \def\w{\realbackslash w }%
  1402. \def\bf{\realbackslash bf }%
  1403. \def\rm{\realbackslash rm }%
  1404. \def\sl{\realbackslash sl }%
  1405. \def\sf{\realbackslash sf}%
  1406. \def\tt{\realbackslash tt}%
  1407. \def\gtr{\realbackslash gtr}%
  1408. \def\less{\realbackslash less}%
  1409. \def\hat{\realbackslash hat}%
  1410. \def\char{\realbackslash char}%
  1411. \def\TeX{\realbackslash TeX}%
  1412. \def\dots{\realbackslash dots }%
  1413. \def\copyright{\realbackslash copyright }%
  1414. \def\tclose##1{\realbackslash tclose {##1}}%
  1415. \def\code##1{\realbackslash code {##1}}%
  1416. \def\samp##1{\realbackslash samp {##1}}%
  1417. \def\t##1{\realbackslash r {##1}}%
  1418. \def\r##1{\realbackslash r {##1}}%
  1419. \def\i##1{\realbackslash i {##1}}%
  1420. \def\b##1{\realbackslash b {##1}}%
  1421. \def\cite##1{\realbackslash cite {##1}}%
  1422. \def\key##1{\realbackslash key {##1}}%
  1423. \def\file##1{\realbackslash file {##1}}%
  1424. \def\var##1{\realbackslash var {##1}}%
  1425. \def\kbd##1{\realbackslash kbd {##1}}%
  1426. \def\dfn##1{\realbackslash dfn {##1}}%
  1427. \def\emph##1{\realbackslash emph {##1}}%
  1428. % \indexnofonts no-ops all font-change commands.
  1429. % This is used when outputting the strings to sort the index by.
  1430. \def\indexdummyfont#1{#1}
  1431. \def\indexdummytex{TeX}
  1432. \def\indexdummydots{...}
  1433. \def\indexnofonts{%
  1434. % Just ignore accents.
  1435. \let\"=\indexdummyfont
  1436. \let\`=\indexdummyfont
  1437. \let\'=\indexdummyfont
  1438. \let\^=\indexdummyfont
  1439. \let\~=\indexdummyfont
  1440. \let\==\indexdummyfont
  1441. \let\b=\indexdummyfont
  1442. \let\c=\indexdummyfont
  1443. \let\d=\indexdummyfont
  1444. \let\u=\indexdummyfont
  1445. \let\v=\indexdummyfont
  1446. \let\H=\indexdummyfont
  1447. % Take care of the plain tex special European modified letters.
  1448. \def\oe{oe}
  1449. \def\ae{ae}
  1450. \def\aa{aa}
  1451. \def\OE{OE}
  1452. \def\AE{AE}
  1453. \def\AA{AA}
  1454. \def\o{o}
  1455. \def\O{O}
  1456. \def\l{l}
  1457. \def\L{L}
  1458. \def\ss{ss}
  1459. \let\w=\indexdummyfont
  1460. \let\t=\indexdummyfont
  1461. \let\r=\indexdummyfont
  1462. \let\i=\indexdummyfont
  1463. \let\b=\indexdummyfont
  1464. \let\emph=\indexdummyfont
  1465. \let\strong=\indexdummyfont
  1466. \let\cite=\indexdummyfont
  1467. \let\sc=\indexdummyfont
  1468. %Don't no-op \tt, since it isn't a user-level command
  1469. % and is used in the definitions of the active chars like <, >, |...
  1470. %\let\tt=\indexdummyfont
  1471. \let\tclose=\indexdummyfont
  1472. \let\code=\indexdummyfont
  1473. \let\file=\indexdummyfont
  1474. \let\samp=\indexdummyfont
  1475. \let\kbd=\indexdummyfont
  1476. \let\key=\indexdummyfont
  1477. \let\var=\indexdummyfont
  1478. \let\TeX=\indexdummytex
  1479. \let\dots=\indexdummydots
  1480. % To define \realbackslash, we must make \ not be an escape.
  1481. % We must first make another character (@) an escape
  1482. % so we do not become unable to do a definition.
  1483. {\catcode`\@=0 \catcode`\\=\other
  1484. @gdef@realbackslash{\}}
  1485. \let\indexbackslash=0  %overridden during \printindex.
  1486. \def\doind #1#2{%
  1487. {\count10=\lastpenalty %
  1488. {\indexdummies % Must do this here, since \bf, etc expand at this stage
  1489. \escapechar=`\\%
  1490. {\let\folio=0% Expand all macros now EXCEPT \folio
  1491. \def\rawbackslashxx{\indexbackslash}% \indexbackslash isn't defined now
  1492. % so it will be output as is; and it will print as backslash in the indx.
  1493. % Now process the index-string once, with all font commands turned off,
  1494. % to get the string to sort the index by.
  1495. {\indexnofonts
  1496. \xdef\temp1{#2}%
  1497. % Now produce the complete index entry.  We process the index-string again,
  1498. % this time with font commands expanded, to get what to print in the index.
  1499. \edef\temp{%
  1500. \write \csname#1indfile\endcsname{%
  1501. \realbackslash entry {\temp1}{\folio}{#2}}}%
  1502. \temp }%
  1503. }\penalty\count10}}
  1504. \def\dosubind #1#2#3{%
  1505. {\count10=\lastpenalty %
  1506. {\indexdummies % Must do this here, since \bf, etc expand at this stage
  1507. \escapechar=`\\%
  1508. {\let\folio=0%
  1509. \def\rawbackslashxx{\indexbackslash}%
  1510. % Now process the index-string once, with all font commands turned off,
  1511. % to get the string to sort the index by.
  1512. {\indexnofonts
  1513. \xdef\temp1{#2 #3}%
  1514. % Now produce the complete index entry.  We process the index-string again,
  1515. % this time with font commands expanded, to get what to print in the index.
  1516. \edef\temp{%
  1517. \write \csname#1indfile\endcsname{%
  1518. \realbackslash entry {\temp1}{\folio}{#2}{#3}}}%
  1519. \temp }%
  1520. }\penalty\count10}}
  1521. % The index entry written in the file actually looks like
  1522. %  \entry {sortstring}{page}{topic}
  1523. %  \entry {sortstring}{page}{topic}{subtopic}
  1524. % The texindex program reads in these files and writes files
  1525. % containing these kinds of lines:
  1526. %  \initial {c}
  1527. %     before the first topic whose initial is c
  1528. %  \entry {topic}{pagelist}
  1529. %     for a topic that is used without subtopics
  1530. %  \primary {topic}
  1531. %     for the beginning of a topic that is used with subtopics
  1532. %  \secondary {subtopic}{pagelist}
  1533. %     for each subtopic.
  1534. % Define the user-accessible indexing commands
  1535. % @findex, @vindex, @kindex, @cindex.
  1536. \def\findex {\fnindex}
  1537. \def\kindex {\kyindex}
  1538. \def\cindex {\cpindex}
  1539. \def\vindex {\vrindex}
  1540. \def\tindex {\tpindex}
  1541. \def\pindex {\pgindex}
  1542. \def\cindexsub {\begingroup\obeylines\cindexsub}
  1543. {\obeylines %
  1544. \gdef\cindexsub "#1" #2^^M{\endgroup %
  1545. \dosubind{cp}{#2}{#1}}}
  1546. % Define the macros used in formatting output of the sorted index material.
  1547. % This is what you call to cause a particular index to get printed.
  1548. % Write
  1549. % @unnumbered Function Index
  1550. % @printindex fn
  1551. \def\printindex{\parsearg\doprintindex}
  1552. \def\doprintindex#1{%
  1553.   \tex
  1554.   \dobreak \chapheadingskip {10000}
  1555.   \catcode`\%=\other\catcode`\&=\other\catcode`\#=\other
  1556.   \catcode`\$=\other
  1557.   \catcode`\~=\other
  1558.   \indexbreaks
  1559.   % The following don't help, since the chars were translated
  1560.   % when the raw index was written, and their fonts were discarded
  1561.   % due to \indexnofonts.
  1562.   %\catcode`\"=\active
  1563.   %\catcode`\^=\active
  1564.   %\catcode`\_=\active
  1565.   %\catcode`\|=\active
  1566.   %\catcode`\<=\active
  1567.   %\catcode`\>=\active
  1568.   % %
  1569.   \def\indexbackslash{\rawbackslashxx}
  1570.   \indexfonts\rm \tolerance=9500 \advance\baselineskip -1pt
  1571.   \begindoublecolumns
  1572.   % See if the index file exists and is nonempty.
  1573.   \openin 1 \jobname.#1s
  1574.   \ifeof 1
  1575.     % \enddoublecolumns gets confused if there is no text in the index,
  1576.     % and it loses the chapter title and the aux file entries for the
  1577.     % index.  The easiest way to prevent this problem is to make sure
  1578.     % there is some text.
  1579.     (Index is nonexistent)
  1580.     \else
  1581.     %
  1582.     % If the index file exists but is empty, then \openin leaves \ifeof
  1583.     % false.  We have to make TeX try to read something from the file, so
  1584.     % it can discover if there is anything in it.
  1585.     \read 1 to \temp
  1586.     \ifeof 1
  1587.       (Index is empty)
  1588.     \else
  1589.       \input \jobname.#1s
  1590.     \fi
  1591.   \fi
  1592.   \closein 1
  1593.   \enddoublecolumns
  1594.   \Etex
  1595. % These macros are used by the sorted index file itself.
  1596. % Change them to control the appearance of the index.
  1597. % Same as \bigskipamount except no shrink.
  1598. % \balancecolumns gets confused if there is any shrink.
  1599. \newskip\initialskipamount \initialskipamount 12pt plus4pt
  1600. \def\initial #1{%
  1601. {\let\tentt=\sectt \let\tt=\sectt \let\sf=\sectt
  1602. \ifdim\lastskip<\initialskipamount
  1603. \removelastskip \penalty-200 \vskip \initialskipamount\fi
  1604. \line{\secbf#1\hfill}\kern 2pt\penalty10000}}
  1605. % This typesets a paragraph consisting of #1, dot leaders, and then #2
  1606. % flush to the right margin.  It is used for index and table of contents
  1607. % entries.  The paragraph is indented by \leftskip.
  1608. \def\entry #1#2{\begingroup
  1609.   % Start a new paragraph if necessary, so our assignments below can't
  1610.   % affect previous text.
  1611.   \par
  1612.   % Do not fill out the last line with white space.
  1613.   \parfillskip = 0in
  1614.   % No extra space above this paragraph.
  1615.   \parskip = 0in
  1616.   % Do not prefer a separate line ending with a hyphen to fewer lines.
  1617.   \finalhyphendemerits = 0
  1618.   % \hangindent is only relevant when the entry text and page number
  1619.   % don't both fit on one line.  In that case, bob suggests starting the
  1620.   % dots pretty far over on the line.  Unfortunately, a large
  1621.   % indentation looks wrong when the entry text itself is broken across
  1622.   % lines.  So we use a small indentation and put up with long leaders.
  1623.   % \hangafter is reset to 1 (which is the value we want) at the start
  1624.   % of each paragraph, so we need not do anything with that.
  1625.   \hangindent=2em
  1626.   % When the entry text needs to be broken, just fill out the first line
  1627.   % with blank space.
  1628.   \rightskip = 0pt plus1fil
  1629.   % Start a ``paragraph'' for the index entry so the line breaking
  1630.   % parameters we've set above will have an effect.
  1631.   \noindent
  1632.   % Insert the text of the index entry.  TeX will do line-breaking on it.
  1633.   #1%
  1634.   % The following is kluged to not output a line of dots in the index if
  1635.   % there are no page numbers.  The next person who breaks this will be
  1636.   % cursed by a Unix daemon.
  1637.   \def\tempa{{\rm }}%
  1638.   \def\tempb{#2}%
  1639.   \edef\tempc{\tempa}%
  1640.   \edef\tempd{\tempb}%
  1641.   \ifx\tempc\tempd\ \else%
  1642.     %
  1643.     % If we must, put the page number on a line of its own, and fill out
  1644.     % this line with blank space.  (The \hfil is overwhelmed with the
  1645.     % fill leaders glue in \indexdotfill if the page number does fit.)
  1646.     \hfil\penalty50
  1647.     \null\nobreak\indexdotfill % Have leaders before the page number.
  1648.     %
  1649.     % The `\ ' here is removed by the implicit \unskip that TeX does as
  1650.     % part of (the primitive) \par.  Without it, a spurious underfull
  1651.     % \hbox ensues.
  1652.     \ #2% The page number ends the paragraph.
  1653.   \fi%
  1654.   \par
  1655. \endgroup}
  1656. % Like \dotfill except takes at least 1 em.
  1657. \def\indexdotfill{\cleaders
  1658.   \hbox{$\mathsurround=0pt \mkern1.5mu ${\it .}$ \mkern1.5mu$}\hskip 1em plus 1fill}
  1659. \def\primary #1{\line{#1\hfil}}
  1660. \newskip\secondaryindent \secondaryindent=0.5cm
  1661. \def\secondary #1#2{
  1662. {\parfillskip=0in \parskip=0in
  1663. \hangindent =1in \hangafter=1
  1664. \noindent\hskip\secondaryindent\hbox{#1}\indexdotfill #2\par
  1665. %% Define two-column mode, which is used in indexes.
  1666. %% Adapted from the TeXbook, page 416.
  1667. \catcode `\@=11
  1668. \newbox\partialpage
  1669. \newdimen\doublecolumnhsize
  1670. \def\begindoublecolumns{\begingroup
  1671.   % Grab any single-column material above us.
  1672.   \output = {\global\setbox\partialpage
  1673.     =\vbox{\unvbox255\kern -\topskip \kern \baselineskip}}%
  1674.   \eject
  1675.   % Now switch to the double-column output routine.
  1676.   \output={\doublecolumnout}%
  1677.   % Change the page size parameters.  We could do this once outside this
  1678.   % routine, in each of @smallbook, @afourpaper, and the default 8.5x11
  1679.   % format, but then we repeat the same computation.  Repeating a couple
  1680.   % of assignments once per index is clearly meaningless for the
  1681.   % execution time, so we may as well do it once.
  1682.   % First we halve the line length, less a little for the gutter between
  1683.   % the columns.  We compute the gutter based on the line length, so it
  1684.   % changes automatically with the paper format.  The magic constant
  1685.   % below is chosen so that the gutter has the same value (well, +- <
  1686.   % 1pt) as it did when we hard-coded it.
  1687.   % We put the result in a separate register, \doublecolumhsize, so we
  1688.   % can restore it in \pagesofar, after \hsize itself has (potentially)
  1689.   % been clobbered.
  1690.   \doublecolumnhsize = \hsize
  1691.     \advance\doublecolumnhsize by -.04154\hsize
  1692.     \divide\doublecolumnhsize by 2
  1693.   \hsize = \doublecolumnhsize
  1694.   % Double the \vsize as well.  (We don't need a separate register here,
  1695.   % since nobody clobbers \vsize.)
  1696.   \vsize = 2\vsize
  1697.   \doublecolumnpagegoal
  1698. \def\enddoublecolumns{\eject \endgroup \pagegoal=\vsize \unvbox\partialpage}
  1699. \def\doublecolumnsplit{\splittopskip=\topskip \splitmaxdepth=\maxdepth
  1700.   \global\dimen@=\pageheight \global\advance\dimen@ by-\ht\partialpage
  1701.   \global\setbox1=\vsplit255 to\dimen@ \global\setbox0=\vbox{\unvbox1}
  1702.   \global\setbox3=\vsplit255 to\dimen@ \global\setbox2=\vbox{\unvbox3}
  1703.   \ifdim\ht0>\dimen@ \setbox255=\vbox{\unvbox0\unvbox2} \global\setbox255=\copy5 \fi
  1704.   \ifdim\ht2>\dimen@ \setbox255=\vbox{\unvbox0\unvbox2} \global\setbox255=\copy5 \fi
  1705. \def\doublecolumnpagegoal{%
  1706.   \dimen@=\vsize \advance\dimen@ by-2\ht\partialpage \global\pagegoal=\dimen@
  1707. \def\pagesofar{\unvbox\partialpage %
  1708.   \hsize=\doublecolumnhsize % have to restore this since output routine
  1709.   \wd0=\hsize \wd2=\hsize \hbox to\pagewidth{\box0\hfil\box2}}
  1710. \def\doublecolumnout{%
  1711.   \setbox5=\copy255
  1712.   {\vbadness=10000 \doublecolumnsplit}
  1713.   \ifvbox255
  1714.     \setbox0=\vtop to\dimen@{\unvbox0}
  1715.     \setbox2=\vtop to\dimen@{\unvbox2}
  1716.     \onepageout\pagesofar \unvbox255 \penalty\outputpenalty
  1717.   \else
  1718.     \setbox0=\vbox{\unvbox5}
  1719.     \ifvbox0
  1720.       \dimen@=\ht0 \advance\dimen@ by\topskip \advance\dimen@ by-\baselineskip
  1721.       \divide\dimen@ by2 \splittopskip=\topskip \splitmaxdepth=\maxdepth
  1722.       {\vbadness=10000
  1723.     \loop \global\setbox5=\copy0
  1724.           \setbox1=\vsplit5 to\dimen@
  1725.           \setbox3=\vsplit5 to\dimen@
  1726.           \ifvbox5 \global\advance\dimen@ by1pt \repeat
  1727.         \setbox0=\vbox to\dimen@{\unvbox1}
  1728.         \setbox2=\vbox to\dimen@{\unvbox3}
  1729.         \global\setbox\partialpage=\vbox{\pagesofar}
  1730.         \doublecolumnpagegoal
  1731.       }
  1732.     \fi
  1733.   \fi
  1734. \catcode `\@=\other
  1735. \message{sectioning,}
  1736. % Define chapters, sections, etc.
  1737. \newcount \chapno
  1738. \newcount \secno        \secno=0
  1739. \newcount \subsecno     \subsecno=0
  1740. \newcount \subsubsecno  \subsubsecno=0
  1741. % This counter is funny since it counts through charcodes of letters A, B, ...
  1742. \newcount \appendixno  \appendixno = `\@
  1743. \def\appendixletter{\char\the\appendixno}
  1744. \newwrite \contentsfile
  1745. % This is called from \setfilename.
  1746. \def\opencontents{\openout \contentsfile = \jobname.toc}
  1747. % Each @chapter defines this as the name of the chapter.
  1748. % page headings and footings can use it.  @section does likewise
  1749. \def\thischapter{} \def\thissection{}
  1750. \def\seccheck#1{\if \pageno<0 %
  1751. \errmessage{@#1 not allowed after generating table of contents}\fi
  1752. \def\chapternofonts{%
  1753. \let\rawbackslash=\relax%
  1754. \let\frenchspacing=\relax%
  1755. \def\result{\realbackslash result}
  1756. \def\equiv{\realbackslash equiv}
  1757. \def\expansion{\realbackslash expansion}
  1758. \def\print{\realbackslash print}
  1759. \def\TeX{\realbackslash TeX}
  1760. \def\dots{\realbackslash dots}
  1761. \def\copyright{\realbackslash copyright}
  1762. \def\tt{\realbackslash tt}
  1763. \def\bf{\realbackslash bf }
  1764. \def\w{\realbackslash w}
  1765. \def\less{\realbackslash less}
  1766. \def\gtr{\realbackslash gtr}
  1767. \def\hat{\realbackslash hat}
  1768. \def\char{\realbackslash char}
  1769. \def\tclose##1{\realbackslash tclose {##1}}
  1770. \def\code##1{\realbackslash code {##1}}
  1771. \def\samp##1{\realbackslash samp {##1}}
  1772. \def\r##1{\realbackslash r {##1}}
  1773. \def\b##1{\realbackslash b {##1}}
  1774. \def\key##1{\realbackslash key {##1}}
  1775. \def\file##1{\realbackslash file {##1}}
  1776. \def\kbd##1{\realbackslash kbd {##1}}
  1777. % These are redefined because @smartitalic wouldn't work inside xdef.
  1778. \def\i##1{\realbackslash i {##1}}
  1779. \def\cite##1{\realbackslash cite {##1}}
  1780. \def\var##1{\realbackslash var {##1}}
  1781. \def\emph##1{\realbackslash emph {##1}}
  1782. \def\dfn##1{\realbackslash dfn {##1}}
  1783. \newcount\absseclevel % used to calculate proper heading level
  1784. \newcount\secbase\secbase=0 % @raise/lowersections modify this count
  1785. % @raisesections: treat @section as chapter, @subsection as section, etc.
  1786. \def\raisesections{\global\advance\secbase by -1}
  1787. \let\up=\raisesections % original BFox name
  1788. % @lowersections: treat @chapter as section, @section as subsection, etc.
  1789. \def\lowersections{\global\advance\secbase by 1}
  1790. \let\down=\lowersections % original BFox name
  1791. % Choose a numbered-heading macro
  1792. % #1 is heading level if unmodified by @raisesections or @lowersections
  1793. % #2 is text for heading
  1794. \def\numhead#1#2{\absseclevel=\secbase\advance\absseclevel by #1
  1795. \ifcase\absseclevel
  1796.   \chapterzzz{#2}
  1797.   \seczzz{#2}
  1798.   \numberedsubseczzz{#2}
  1799.   \numberedsubsubseczzz{#2}
  1800. \else
  1801.   \ifnum \absseclevel<0
  1802.     \chapterzzz{#2}
  1803.   \else
  1804.     \numberedsubsubseczzz{#2}
  1805.   \fi
  1806. % like \numhead, but chooses appendix heading levels
  1807. \def\apphead#1#2{\absseclevel=\secbase\advance\absseclevel by #1
  1808. \ifcase\absseclevel
  1809.   \appendixzzz{#2}
  1810.   \appendixsectionzzz{#2}
  1811.   \appendixsubseczzz{#2}
  1812.   \appendixsubsubseczzz{#2}
  1813. \else
  1814.   \ifnum \absseclevel<0
  1815.     \appendixzzz{#2}
  1816.   \else
  1817.     \appendixsubsubseczzz{#2}
  1818.   \fi
  1819. % like \numhead, but chooses numberless heading levels
  1820. \def\unnmhead#1#2{\absseclevel=\secbase\advance\absseclevel by #1
  1821. \ifcase\absseclevel
  1822.   \unnumberedzzz{#2}
  1823.   \unnumberedseczzz{#2}
  1824.   \unnumberedsubseczzz{#2}
  1825.   \unnumberedsubsubseczzz{#2}
  1826. \else
  1827.   \ifnum \absseclevel<0
  1828.     \unnumberedzzz{#2}
  1829.   \else
  1830.     \unnumberedsubsubseczzz{#2}
  1831.   \fi
  1832. \def\thischaptername{No Chapter Title}
  1833. \outer\def\chapter{\parsearg\chapteryyy}
  1834. \def\chapteryyy #1{\numhead0{#1}} % normally numhead0 calls chapterzzz
  1835. \def\chapterzzz #1{\seccheck{chapter}%
  1836. \secno=0 \subsecno=0 \subsubsecno=0
  1837. \global\advance \chapno by 1 \message{Chapter \the\chapno}%
  1838. \chapmacro {#1}{\the\chapno}%
  1839. \gdef\thissection{#1}%
  1840. \gdef\thischaptername{#1}%
  1841. % We don't substitute the actual chapter name into \thischapter
  1842. % because we don't want its macros evaluated now.
  1843. \xdef\thischapter{\putwordChapter{} \the\chapno: \noexpand\thischaptername}%
  1844. {\chapternofonts%
  1845. \edef\temp{{\realbackslash chapentry {#1}{\the\chapno}{\noexpand\folio}}}%
  1846. \escapechar=`\\%
  1847. \write \contentsfile \temp  %
  1848. \donoderef %
  1849. \global\let\section = \numberedsec
  1850. \global\let\subsection = \numberedsubsec
  1851. \global\let\subsubsection = \numberedsubsubsec
  1852. \outer\def\appendix{\parsearg\appendixyyy}
  1853. \def\appendixyyy #1{\apphead0{#1}} % normally apphead0 calls appendixzzz
  1854. \def\appendixzzz #1{\seccheck{appendix}%
  1855. \secno=0 \subsecno=0 \subsubsecno=0
  1856. \global\advance \appendixno by 1 \message{Appendix \appendixletter}%
  1857. \chapmacro {#1}{\putwordAppendix{} \appendixletter}%
  1858. \gdef\thissection{#1}%
  1859. \gdef\thischaptername{#1}%
  1860. \xdef\thischapter{\putwordAppendix{} \appendixletter: \noexpand\thischaptername}%
  1861. {\chapternofonts%
  1862. \edef\temp{{\realbackslash chapentry
  1863.   {#1}{\putwordAppendix{} \appendixletter}{\noexpand\folio}}}%
  1864. \escapechar=`\\%
  1865. \write \contentsfile \temp  %
  1866. \appendixnoderef %
  1867. \global\let\section = \appendixsec
  1868. \global\let\subsection = \appendixsubsec
  1869. \global\let\subsubsection = \appendixsubsubsec
  1870. \outer\def\top{\parsearg\unnumberedyyy}
  1871. \outer\def\unnumbered{\parsearg\unnumberedyyy}
  1872. \def\unnumberedyyy #1{\unnmhead0{#1}} % normally unnmhead0 calls unnumberedzzz
  1873. \def\unnumberedzzz #1{\seccheck{unnumbered}%
  1874. \secno=0 \subsecno=0 \subsubsecno=0
  1875. % This used to be simply \message{#1}, but TeX fully expands the
  1876. % argument to \message.  Therefore, if #1 contained @-commands, TeX
  1877. % expanded them.  For example, in `@unnumbered The @cite{Book}', TeX
  1878. % expanded @cite (which turns out to cause errors because \cite is meant
  1879. % to be executed, not expanded).
  1880. % Anyway, we don't want the fully-expanded definition of @cite to appear
  1881. % as a result of the \message, we just want `@cite' itself.  We use
  1882. % \the<toks register> to achieve this: TeX expands \the<toks> only once,
  1883. % simply yielding the contents of the <toks register>.
  1884. \toks0 = {#1}\message{(\the\toks0)}%
  1885. \unnumbchapmacro {#1}%
  1886. \gdef\thischapter{#1}\gdef\thissection{#1}%
  1887. {\chapternofonts%
  1888. \edef\temp{{\realbackslash unnumbchapentry {#1}{\noexpand\folio}}}%
  1889. \escapechar=`\\%
  1890. \write \contentsfile \temp  %
  1891. \unnumbnoderef %
  1892. \global\let\section = \unnumberedsec
  1893. \global\let\subsection = \unnumberedsubsec
  1894. \global\let\subsubsection = \unnumberedsubsubsec
  1895. \outer\def\numberedsec{\parsearg\secyyy}
  1896. \def\secyyy #1{\numhead1{#1}} % normally calls seczzz
  1897. \def\seczzz #1{\seccheck{section}%
  1898. \subsecno=0 \subsubsecno=0 \global\advance \secno by 1 %
  1899. \gdef\thissection{#1}\secheading {#1}{\the\chapno}{\the\secno}%
  1900. {\chapternofonts%
  1901. \edef\temp{{\realbackslash secentry %
  1902. {#1}{\the\chapno}{\the\secno}{\noexpand\folio}}}%
  1903. \escapechar=`\\%
  1904. \write \contentsfile \temp %
  1905. \donoderef %
  1906. \penalty 10000 %
  1907. \outer\def\appenixsection{\parsearg\appendixsecyyy}
  1908. \outer\def\appendixsec{\parsearg\appendixsecyyy}
  1909. \def\appendixsecyyy #1{\apphead1{#1}} % normally calls appendixsectionzzz
  1910. \def\appendixsectionzzz #1{\seccheck{appendixsection}%
  1911. \subsecno=0 \subsubsecno=0 \global\advance \secno by 1 %
  1912. \gdef\thissection{#1}\secheading {#1}{\appendixletter}{\the\secno}%
  1913. {\chapternofonts%
  1914. \edef\temp{{\realbackslash secentry %
  1915. {#1}{\appendixletter}{\the\secno}{\noexpand\folio}}}%
  1916. \escapechar=`\\%
  1917. \write \contentsfile \temp %
  1918. \appendixnoderef %
  1919. \penalty 10000 %
  1920. \outer\def\unnumberedsec{\parsearg\unnumberedsecyyy}
  1921. \def\unnumberedsecyyy #1{\unnmhead1{#1}} % normally calls unnumberedseczzz
  1922. \def\unnumberedseczzz #1{\seccheck{unnumberedsec}%
  1923. \plainsecheading {#1}\gdef\thissection{#1}%
  1924. {\chapternofonts%
  1925. \edef\temp{{\realbackslash unnumbsecentry{#1}{\noexpand\folio}}}%
  1926. \escapechar=`\\%
  1927. \write \contentsfile \temp %
  1928. \unnumbnoderef %
  1929. \penalty 10000 %
  1930. \outer\def\numberedsubsec{\parsearg\numberedsubsecyyy}
  1931. \def\numberedsubsecyyy #1{\numhead2{#1}} % normally calls numberedsubseczzz
  1932. \def\numberedsubseczzz #1{\seccheck{subsection}%
  1933. \gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 %
  1934. \subsecheading {#1}{\the\chapno}{\the\secno}{\the\subsecno}%
  1935. {\chapternofonts%
  1936. \edef\temp{{\realbackslash subsecentry %
  1937. {#1}{\the\chapno}{\the\secno}{\the\subsecno}{\noexpand\folio}}}%
  1938. \escapechar=`\\%
  1939. \write \contentsfile \temp %
  1940. \donoderef %
  1941. \penalty 10000 %
  1942. \outer\def\appendixsubsec{\parsearg\appendixsubsecyyy}
  1943. \def\appendixsubsecyyy #1{\apphead2{#1}} % normally calls appendixsubseczzz
  1944. \def\appendixsubseczzz #1{\seccheck{appendixsubsec}%
  1945. \gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 %
  1946. \subsecheading {#1}{\appendixletter}{\the\secno}{\the\subsecno}%
  1947. {\chapternofonts%
  1948. \edef\temp{{\realbackslash subsecentry %
  1949. {#1}{\appendixletter}{\the\secno}{\the\subsecno}{\noexpand\folio}}}%
  1950. \escapechar=`\\%
  1951. \write \contentsfile \temp %
  1952. \appendixnoderef %
  1953. \penalty 10000 %
  1954. \outer\def\unnumberedsubsec{\parsearg\unnumberedsubsecyyy}
  1955. \def\unnumberedsubsecyyy #1{\unnmhead2{#1}} %normally calls unnumberedsubseczzz
  1956. \def\unnumberedsubseczzz #1{\seccheck{unnumberedsubsec}%
  1957. \plainsecheading {#1}\gdef\thissection{#1}%
  1958. {\chapternofonts%
  1959. \edef\temp{{\realbackslash unnumbsubsecentry{#1}{\noexpand\folio}}}%
  1960. \escapechar=`\\%
  1961. \write \contentsfile \temp %
  1962. \unnumbnoderef %
  1963. \penalty 10000 %
  1964. \outer\def\numberedsubsubsec{\parsearg\numberedsubsubsecyyy}
  1965. \def\numberedsubsubsecyyy #1{\numhead3{#1}} % normally numberedsubsubseczzz
  1966. \def\numberedsubsubseczzz #1{\seccheck{subsubsection}%
  1967. \gdef\thissection{#1}\global\advance \subsubsecno by 1 %
  1968. \subsubsecheading {#1}
  1969.   {\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}%
  1970. {\chapternofonts%
  1971. \edef\temp{{\realbackslash subsubsecentry %
  1972.   {#1}
  1973.   {\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}
  1974.   {\noexpand\folio}}}%
  1975. \escapechar=`\\%
  1976. \write \contentsfile \temp %
  1977. \donoderef %
  1978. \penalty 10000 %
  1979. \outer\def\appendixsubsubsec{\parsearg\appendixsubsubsecyyy}
  1980. \def\appendixsubsubsecyyy #1{\apphead3{#1}} % normally appendixsubsubseczzz
  1981. \def\appendixsubsubseczzz #1{\seccheck{appendixsubsubsec}%
  1982. \gdef\thissection{#1}\global\advance \subsubsecno by 1 %
  1983. \subsubsecheading {#1}
  1984.   {\appendixletter}{\the\secno}{\the\subsecno}{\the\subsubsecno}%
  1985. {\chapternofonts%
  1986. \edef\temp{{\realbackslash subsubsecentry{#1}%
  1987.   {\appendixletter}
  1988.   {\the\secno}{\the\subsecno}{\the\subsubsecno}{\noexpand\folio}}}%
  1989. \escapechar=`\\%
  1990. \write \contentsfile \temp %
  1991. \appendixnoderef %
  1992. \penalty 10000 %
  1993. \outer\def\unnumberedsubsubsec{\parsearg\unnumberedsubsubsecyyy}
  1994. \def\unnumberedsubsubsecyyy #1{\unnmhead3{#1}} %normally unnumberedsubsubseczzz
  1995. \def\unnumberedsubsubseczzz #1{\seccheck{unnumberedsubsubsec}%
  1996. \plainsecheading {#1}\gdef\thissection{#1}%
  1997. {\chapternofonts%
  1998. \edef\temp{{\realbackslash unnumbsubsubsecentry{#1}{\noexpand\folio}}}%
  1999. \escapechar=`\\%
  2000. \write \contentsfile \temp %
  2001. \unnumbnoderef %
  2002. \penalty 10000 %
  2003. % These are variants which are not "outer", so they can appear in @ifinfo.
  2004. % Actually, they should now be obsolete; ordinary section commands should work.
  2005. \def\infotop{\parsearg\unnumberedzzz}
  2006. \def\infounnumbered{\parsearg\unnumberedzzz}
  2007. \def\infounnumberedsec{\parsearg\unnumberedseczzz}
  2008. \def\infounnumberedsubsec{\parsearg\unnumberedsubseczzz}
  2009. \def\infounnumberedsubsubsec{\parsearg\unnumberedsubsubseczzz}
  2010. \def\infoappendix{\parsearg\appendixzzz}
  2011. \def\infoappendixsec{\parsearg\appendixseczzz}
  2012. \def\infoappendixsubsec{\parsearg\appendixsubseczzz}
  2013. \def\infoappendixsubsubsec{\parsearg\appendixsubsubseczzz}
  2014. \def\infochapter{\parsearg\chapterzzz}
  2015. \def\infosection{\parsearg\sectionzzz}
  2016. \def\infosubsection{\parsearg\subsectionzzz}
  2017. \def\infosubsubsection{\parsearg\subsubsectionzzz}
  2018. % These macros control what the section commands do, according
  2019. % to what kind of chapter we are in (ordinary, appendix, or unnumbered).
  2020. % Define them by default for a numbered chapter.
  2021. \global\let\section = \numberedsec
  2022. \global\let\subsection = \numberedsubsec
  2023. \global\let\subsubsection = \numberedsubsubsec
  2024. % Define @majorheading, @heading and @subheading
  2025. % NOTE on use of \vbox for chapter headings, section headings, and
  2026. % such:
  2027. %    1) We use \vbox rather than the earlier \line to permit
  2028. %       overlong headings to fold.
  2029. %    2) \hyphenpenalty is set to 10000 because hyphenation in a
  2030. %       heading is obnoxious; this forbids it.
  2031. %       3) Likewise, headings look best if no \parindent is used, and
  2032. %          if justification is not attempted.  Hence \raggedright.
  2033. \def\majorheading{\parsearg\majorheadingzzz}
  2034. \def\majorheadingzzz #1{%
  2035. {\advance\chapheadingskip by 10pt \chapbreak }%
  2036. {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
  2037.                   \parindent=0pt\raggedright
  2038.                   \rm #1\hfill}}\bigskip \par\penalty 200}
  2039. \def\chapheading{\parsearg\chapheadingzzz}
  2040. \def\chapheadingzzz #1{\chapbreak %
  2041. {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
  2042.                   \parindent=0pt\raggedright
  2043.                   \rm #1\hfill}}\bigskip \par\penalty 200}
  2044. \def\heading{\parsearg\secheadingi}
  2045. \def\subheading{\parsearg\subsecheadingi}
  2046. \def\subsubheading{\parsearg\subsubsecheadingi}
  2047. % These macros generate a chapter, section, etc. heading only
  2048. % (including whitespace, linebreaking, etc. around it),
  2049. % given all the information in convenient, parsed form.
  2050. %%% Args are the skip and penalty (usually negative)
  2051. \def\dobreak#1#2{\par\ifdim\lastskip<#1\removelastskip\penalty#2\vskip#1\fi}
  2052. \def\setchapterstyle #1 {\csname CHAPF#1\endcsname}
  2053. %%% Define plain chapter starts, and page on/off switching for it
  2054. % Parameter controlling skip before chapter headings (if needed)
  2055. \newskip \chapheadingskip \chapheadingskip = 30pt plus 8pt minus 4pt
  2056. \def\chapbreak{\dobreak \chapheadingskip {-4000}}
  2057. \def\chappager{\par\vfill\supereject}
  2058. \def\chapoddpage{\chappager \ifodd\pageno \else \hbox to 0pt{} \chappager\fi}
  2059. \def\setchapternewpage #1 {\csname CHAPPAG#1\endcsname}
  2060. \def\CHAPPAGoff{
  2061. \global\let\pchapsepmacro=\chapbreak
  2062. \global\let\pagealignmacro=\chappager}
  2063. \def\CHAPPAGon{
  2064. \global\let\pchapsepmacro=\chappager
  2065. \global\let\pagealignmacro=\chappager
  2066. \global\def\HEADINGSon{\HEADINGSsingle}}
  2067. \def\CHAPPAGodd{
  2068. \global\let\pchapsepmacro=\chapoddpage
  2069. \global\let\pagealignmacro=\chapoddpage
  2070. \global\def\HEADINGSon{\HEADINGSdouble}}
  2071. \CHAPPAGon
  2072. \def\CHAPFplain{
  2073. \global\let\chapmacro=\chfplain
  2074. \global\let\unnumbchapmacro=\unnchfplain}
  2075. \def\chfplain #1#2{%
  2076.   \pchapsepmacro
  2077.     \chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
  2078.                      \parindent=0pt\raggedright
  2079.                      \rm #2\enspace #1}%
  2080.   \bigskip
  2081.   \penalty5000
  2082. \def\unnchfplain #1{%
  2083. \pchapsepmacro %
  2084. {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
  2085.                   \parindent=0pt\raggedright
  2086.                   \rm #1\hfill}}\bigskip \par\penalty 10000 %
  2087. \CHAPFplain % The default
  2088. \def\unnchfopen #1{%
  2089. \chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
  2090.                        \parindent=0pt\raggedright
  2091.                        \rm #1\hfill}}\bigskip \par\penalty 10000 %
  2092. \def\chfopen #1#2{\chapoddpage {\chapfonts
  2093. \vbox to 3in{\vfil \hbox to\hsize{\hfil #2} \hbox to\hsize{\hfil #1} \vfil}}%
  2094. \par\penalty 5000 %
  2095. \def\CHAPFopen{
  2096. \global\let\chapmacro=\chfopen
  2097. \global\let\unnumbchapmacro=\unnchfopen}
  2098. % Parameter controlling skip before section headings.
  2099. \newskip \subsecheadingskip  \subsecheadingskip = 17pt plus 8pt minus 4pt
  2100. \def\subsecheadingbreak{\dobreak \subsecheadingskip {-500}}
  2101. \newskip \secheadingskip  \secheadingskip = 21pt plus 8pt minus 4pt
  2102. \def\secheadingbreak{\dobreak \secheadingskip {-1000}}
  2103. % @paragraphindent  is defined for the Info formatting commands only.
  2104. \let\paragraphindent=\comment
  2105. % Section fonts are the base font at magstep2, which produces
  2106. % a size a bit more than 14 points in the default situation.
  2107. \def\secheading #1#2#3{\secheadingi {#2.#3\enspace #1}}
  2108. \def\plainsecheading #1{\secheadingi {#1}}
  2109. \def\secheadingi #1{{\advance \secheadingskip by \parskip %
  2110. \secheadingbreak}%
  2111. {\secfonts \vbox{\hyphenpenalty=10000\tolerance=5000
  2112.                  \parindent=0pt\raggedright
  2113.                  \rm #1\hfill}}%
  2114. \ifdim \parskip<10pt \kern 10pt\kern -\parskip\fi \penalty 10000 }
  2115. % Subsection fonts are the base font at magstep1,
  2116. % which produces a size of 12 points.
  2117. \def\subsecheading #1#2#3#4{\subsecheadingi {#2.#3.#4\enspace #1}}
  2118. \def\subsecheadingi #1{{\advance \subsecheadingskip by \parskip %
  2119. \subsecheadingbreak}%
  2120. {\subsecfonts \vbox{\hyphenpenalty=10000\tolerance=5000
  2121.                      \parindent=0pt\raggedright
  2122.                      \rm #1\hfill}}%
  2123. \ifdim \parskip<10pt \kern 10pt\kern -\parskip\fi \penalty 10000 }
  2124. \def\subsubsecfonts{\subsecfonts} % Maybe this should change:
  2125.                   % Perhaps make sssec fonts scaled
  2126.                   % magstep half
  2127. \def\subsubsecheading #1#2#3#4#5{\subsubsecheadingi {#2.#3.#4.#5\enspace #1}}
  2128. \def\subsubsecheadingi #1{{\advance \subsecheadingskip by \parskip %
  2129. \subsecheadingbreak}%
  2130. {\subsubsecfonts \vbox{\hyphenpenalty=10000\tolerance=5000
  2131.                        \parindent=0pt\raggedright
  2132.                        \rm #1\hfill}}%
  2133. \ifdim \parskip<10pt \kern 10pt\kern -\parskip\fi \penalty 10000}
  2134. \message{toc printing,}
  2135. % Finish up the main text and prepare to read what we've written
  2136. % to \contentsfile.
  2137. \newskip\contentsrightmargin \contentsrightmargin=1in
  2138. \def\startcontents#1{%
  2139.    \pagealignmacro
  2140.    \immediate\closeout \contentsfile
  2141.    \ifnum \pageno>0
  2142.       \pageno = -1        % Request roman numbered pages.
  2143.    \fi
  2144.    % Don't need to put `Contents' or `Short Contents' in the headline.
  2145.    % It is abundantly clear what they are.
  2146.    \unnumbchapmacro{#1}\def\thischapter{}%
  2147.    \begingroup           % Set up to handle contents files properly.
  2148.       \catcode`\\=0  \catcode`\{=1  \catcode`\}=2  \catcode`\@=11
  2149.       \raggedbottom             % Worry more about breakpoints than the bottom.
  2150.       \advance\hsize by -\contentsrightmargin % Don't use the full line length.
  2151. % Normal (long) toc.
  2152. \outer\def\contents{%
  2153.    \startcontents{\putwordTableofContents}%
  2154.       \input \jobname.toc
  2155.    \endgroup
  2156.    \vfill \eject
  2157. % And just the chapters.
  2158. \outer\def\summarycontents{%
  2159.    \startcontents{\putwordShortContents}%
  2160.       %
  2161.       \let\chapentry = \shortchapentry
  2162.       \let\unnumbchapentry = \shortunnumberedentry
  2163.       % We want a true roman here for the page numbers.
  2164.       \secfonts
  2165.       \let\rm=\shortcontrm \let\bf=\shortcontbf \let\sl=\shortcontsl
  2166.       \rm
  2167.       \advance\baselineskip by 1pt % Open it up a little.
  2168.       \def\secentry ##1##2##3##4{}
  2169.       \def\unnumbsecentry ##1##2{}
  2170.       \def\subsecentry ##1##2##3##4##5{}
  2171.       \def\unnumbsubsecentry ##1##2{}
  2172.       \def\subsubsecentry ##1##2##3##4##5##6{}
  2173.       \def\unnumbsubsubsecentry ##1##2{}
  2174.       \input \jobname.toc
  2175.    \endgroup
  2176.    \vfill \eject
  2177. \let\shortcontents = \summarycontents
  2178. % These macros generate individual entries in the table of contents.
  2179. % The first argument is the chapter or section name.
  2180. % The last argument is the page number.
  2181. % The arguments in between are the chapter number, section number, ...
  2182. % Chapter-level things, for both the long and short contents.
  2183. \def\chapentry#1#2#3{\dochapentry{#2\labelspace#1}{#3}}
  2184. % See comments in \dochapentry re vbox and related settings
  2185. \def\shortchapentry#1#2#3{%
  2186.   \tocentry{\shortchaplabel{#2}\labelspace #1}{\doshortpageno{#3}}%
  2187. % Typeset the label for a chapter or appendix for the short contents.
  2188. % The arg is, e.g. `Appendix A' for an appendix, or `3' for a chapter.
  2189. % We could simplify the code here by writing out an \appendixentry
  2190. % command in the toc file for appendices, instead of using \chapentry
  2191. % for both, but it doesn't seem worth it.
  2192. \setbox0 = \hbox{\shortcontrm \putwordAppendix }
  2193. \newdimen\shortappendixwidth \shortappendixwidth = \wd0
  2194. \def\shortchaplabel#1{%
  2195.   % We typeset #1 in a box of constant width, regardless of the text of
  2196.   % #1, so the chapter titles will come out aligned.
  2197.   \setbox0 = \hbox{#1}%
  2198.   \dimen0 = \ifdim\wd0 > \shortappendixwidth \shortappendixwidth \else 0pt \fi
  2199.   % This space should be plenty, since a single number is .5em, and the
  2200.   % widest letter (M) is 1em, at least in the Computer Modern fonts.
  2201.   % (This space doesn't include the extra space that gets added after
  2202.   % the label; that gets put in in \shortchapentry above.)
  2203.   \advance\dimen0 by 1.1em
  2204.   \hbox to \dimen0{#1\hfil}%
  2205. \def\unnumbchapentry#1#2{\dochapentry{#1}{#2}}
  2206. \def\shortunnumberedentry#1#2{\tocentry{#1}{\doshortpageno{#2}}}
  2207. % Sections.
  2208. \def\secentry#1#2#3#4{\dosecentry{#2.#3\labelspace#1}{#4}}
  2209. \def\unnumbsecentry#1#2{\dosecentry{#1}{#2}}
  2210. % Subsections.
  2211. \def\subsecentry#1#2#3#4#5{\dosubsecentry{#2.#3.#4\labelspace#1}{#5}}
  2212. \def\unnumbsubsecentry#1#2{\dosubsecentry{#1}{#2}}
  2213. % And subsubsections.
  2214. \def\subsubsecentry#1#2#3#4#5#6{%
  2215.   \dosubsubsecentry{#2.#3.#4.#5\labelspace#1}{#6}}
  2216. \def\unnumbsubsubsecentry#1#2{\dosubsubsecentry{#1}{#2}}
  2217. % This parameter controls the indentation of the various levels.
  2218. \newdimen\tocindent \tocindent = 3pc
  2219. % Now for the actual typesetting. In all these, #1 is the text and #2 is the
  2220. % page number.
  2221. % If the toc has to be broken over pages, we would want to be at chapters
  2222. % if at all possible; hence the \penalty.
  2223. \def\dochapentry#1#2{%
  2224.    \penalty-300 \vskip\baselineskip
  2225.    \begingroup
  2226.      \chapentryfonts
  2227.      \tocentry{#1}{\dopageno{#2}}%
  2228.    \endgroup
  2229.    \nobreak\vskip .25\baselineskip
  2230. \def\dosecentry#1#2{\begingroup
  2231.   \secentryfonts \leftskip=\tocindent
  2232.   \tocentry{#1}{\dopageno{#2}}%
  2233. \endgroup}
  2234. \def\dosubsecentry#1#2{\begingroup
  2235.   \subsecentryfonts \leftskip=2\tocindent
  2236.   \tocentry{#1}{\dopageno{#2}}%
  2237. \endgroup}
  2238. \def\dosubsubsecentry#1#2{\begingroup
  2239.   \subsubsecentryfonts \leftskip=3\tocindent
  2240.   \tocentry{#1}{\dopageno{#2}}%
  2241. \endgroup}
  2242. % Final typesetting of a toc entry; we use the same \entry macro as for
  2243. % the index entries, but we want to suppress hyphenation here.  (We
  2244. % can't do that in the \entry macro, since index entries might consist
  2245. % of hyphenated-identifiers-that-do-not-fit-on-a-line-and-nothing-else.)
  2246. \def\tocentry#1#2{\begingroup
  2247.   \hyphenpenalty = 10000
  2248.   \entry{#1}{#2}%
  2249. \endgroup}
  2250. % Space between chapter (or whatever) number and the title.
  2251. \def\labelspace{\hskip1em \relax}
  2252. \def\dopageno#1{{\rm #1}}
  2253. \def\doshortpageno#1{{\rm #1}}
  2254. \def\chapentryfonts{\secfonts \rm}
  2255. \def\secentryfonts{\textfonts}
  2256. \let\subsecentryfonts = \textfonts
  2257. \let\subsubsecentryfonts = \textfonts
  2258. \message{environments,}
  2259. % Since these characters are used in examples, it should be an even number of
  2260. % \tt widths. Each \tt character is 1en, so two makes it 1em.
  2261. % Furthermore, these definitions must come after we define our fonts.
  2262. \newbox\dblarrowbox    \newbox\longdblarrowbox
  2263. \newbox\pushcharbox    \newbox\bullbox
  2264. \newbox\equivbox       \newbox\errorbox
  2265. \let\ptexequiv = \equiv
  2266. %{\tentt
  2267. %\global\setbox\dblarrowbox = \hbox to 1em{\hfil$\Rightarrow$\hfil}
  2268. %\global\setbox\longdblarrowbox = \hbox to 1em{\hfil$\mapsto$\hfil}
  2269. %\global\setbox\pushcharbox = \hbox to 1em{\hfil$\dashv$\hfil}
  2270. %\global\setbox\equivbox = \hbox to 1em{\hfil$\ptexequiv$\hfil}
  2271. % Adapted from the manmac format (p.420 of TeXbook)
  2272. %\global\setbox\bullbox = \hbox to 1em{\kern.15em\vrule height .75ex width .85ex
  2273. %                                      depth .1ex\hfil}
  2274. \def\point{$\star$}
  2275. \def\result{\leavevmode\raise.15ex\hbox to 1em{\hfil$\Rightarrow$\hfil}}
  2276. \def\expansion{\leavevmode\raise.1ex\hbox to 1em{\hfil$\mapsto$\hfil}}
  2277. \def\print{\leavevmode\lower.1ex\hbox to 1em{\hfil$\dashv$\hfil}}
  2278. \def\equiv{\leavevmode\lower.1ex\hbox to 1em{\hfil$\ptexequiv$\hfil}}
  2279. % Adapted from the TeXbook's \boxit.
  2280. {\tentt \global\dimen0 = 3em}% Width of the box.
  2281. \dimen2 = .55pt % Thickness of rules
  2282. % The text. (`r' is open on the right, `e' somewhat less so on the left.)
  2283. \setbox0 = \hbox{\kern-.75pt \tensf error\kern-1.5pt}
  2284. \global\setbox\errorbox=\hbox to \dimen0{\hfil
  2285.    \hsize = \dimen0 \advance\hsize by -5.8pt % Space to left+right.
  2286.    \advance\hsize by -2\dimen2 % Rules.
  2287.    \vbox{
  2288.       \hrule height\dimen2
  2289.       \hbox{\vrule width\dimen2 \kern3pt          % Space to left of text.
  2290.          \vtop{\kern2.4pt \box0 \kern2.4pt}% Space above/below.
  2291.          \kern3pt\vrule width\dimen2}% Space to right.
  2292.       \hrule height\dimen2}
  2293.     \hfil}
  2294. % The @error{} command.
  2295. \def\error{\leavevmode\lower.7ex\copy\errorbox}
  2296. % @tex ... @end tex    escapes into raw Tex temporarily.
  2297. % One exception: @ is still an escape character, so that @end tex works.
  2298. % But \@ or @@ will get a plain tex @ character.
  2299. \def\tex{\begingroup
  2300. \catcode `\\=0 \catcode `\{=1 \catcode `\}=2
  2301. \catcode `\$=3 \catcode `\&=4 \catcode `\#=6
  2302. \catcode `\^=7 \catcode `\_=8 \catcode `\~=13 \let~=\tie
  2303. \catcode `\%=14
  2304. \catcode 43=12
  2305. \catcode`\"=12
  2306. \catcode`\==12
  2307. \catcode`\|=12
  2308. \catcode`\<=12
  2309. \catcode`\>=12
  2310. \escapechar=`\\
  2311. \let\{=\ptexlbrace
  2312. \let\}=\ptexrbrace
  2313. \let\.=\ptexdot
  2314. \let\*=\ptexstar
  2315. \let\dots=\ptexdots
  2316. \def\@{@}%
  2317. \let\bullet=\ptexbullet
  2318. \let\b=\ptexb \let\c=\ptexc \let\i=\ptexi \let\t=\ptext \let\l=\ptexl
  2319. \let\L=\ptexL
  2320. \let\Etex=\endgroup}
  2321. % Define @lisp ... @endlisp.
  2322. % @lisp does a \begingroup so it can rebind things,
  2323. % including the definition of @endlisp (which normally is erroneous).
  2324. % Amount to narrow the margins by for @lisp.
  2325. \newskip\lispnarrowing \lispnarrowing=0.4in
  2326. % This is the definition that ^^M gets inside @lisp, @example, and other
  2327. % such environments.  \null is better than a space, since it doesn't
  2328. % have any width.
  2329. \def\lisppar{\null\endgraf}
  2330. % Make each space character in the input produce a normal interword
  2331. % space in the output.  Don't allow a line break at this space, as this
  2332. % is used only in environments like @example, where each line of input
  2333. % should produce a line of output anyway.
  2334. {\obeyspaces %
  2335. \gdef\sepspaces{\obeyspaces\let =\tie}}
  2336. % Define \obeyedspace to be our active space, whatever it is.  This is
  2337. % for use in \parsearg.
  2338. {\sepspaces%
  2339. \global\let\obeyedspace= }
  2340. % This space is always present above and below environments.
  2341. \newskip\envskipamount \envskipamount = 0pt
  2342. % Make spacing and below environment symmetrical.  We use \parskip here
  2343. % to help in doing that, since in @example-like environments \parskip
  2344. % is reset to zero; thus the \afterenvbreak inserts no space -- but the
  2345. % start of the next paragraph will insert \parskip
  2346. \def\aboveenvbreak{{\advance\envskipamount by \parskip
  2347. \endgraf \ifdim\lastskip<\envskipamount
  2348. \removelastskip \penalty-50 \vskip\envskipamount \fi}}
  2349. \let\afterenvbreak = \aboveenvbreak
  2350. % \nonarrowing is a flag.  If "set", @lisp etc don't narrow margins.
  2351. \let\nonarrowing=\relax
  2352. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  2353. % \cartouche: draw rectangle w/rounded corners around argument
  2354. \font\circle=lcircle10
  2355. \newdimen\circthick
  2356. \newdimen\cartouter\newdimen\cartinner
  2357. \newskip\normbskip\newskip\normpskip\newskip\normlskip
  2358. \circthick=\fontdimen8\circle
  2359. \def\ctl{{\circle\char'013\hskip -6pt}}% 6pt from pl file: 1/2charwidth
  2360. \def\ctr{{\hskip 6pt\circle\char'010}}
  2361. \def\cbl{{\circle\char'012\hskip -6pt}}
  2362. \def\cbr{{\hskip 6pt\circle\char'011}}
  2363. \def\carttop{\hbox to \cartouter{\hskip\lskip
  2364.     \ctl\leaders\hrule height\circthick\hfil\ctr
  2365.     \hskip\rskip}}
  2366. \def\cartbot{\hbox to \cartouter{\hskip\lskip
  2367.     \cbl\leaders\hrule height\circthick\hfil\cbr
  2368.     \hskip\rskip}}
  2369. \newskip\lskip\newskip\rskip
  2370. \long\def\cartouche{%
  2371. \begingroup
  2372.     \lskip=\leftskip \rskip=\rightskip
  2373.     \leftskip=0pt\rightskip=0pt %we want these *outside*.
  2374.     \cartinner=\hsize \advance\cartinner by-\lskip
  2375.                \advance\cartinner by-\rskip
  2376.     \cartouter=\hsize
  2377.     \advance\cartouter by 18pt % allow for 3pt kerns on either
  2378. %                     side, and for 6pt waste from
  2379. %                     each corner char
  2380.     \normbskip=\baselineskip \normpskip=\parskip \normlskip=\lineskip
  2381.     % Flag to tell @lisp, etc., not to narrow margin.
  2382.     \let\nonarrowing=\comment
  2383.     \vbox\bgroup
  2384.         \baselineskip=0pt\parskip=0pt\lineskip=0pt
  2385.         \carttop
  2386.         \hbox\bgroup
  2387.             \hskip\lskip
  2388.             \vrule\kern3pt
  2389.             \vbox\bgroup
  2390.                 \hsize=\cartinner
  2391.                 \kern3pt
  2392.                 \begingroup
  2393.                     \baselineskip=\normbskip
  2394.                     \lineskip=\normlskip
  2395.                     \parskip=\normpskip
  2396.                     \vskip -\parskip
  2397. \def\Ecartouche{%
  2398.                 \endgroup
  2399.                 \kern3pt
  2400.             \egroup
  2401.             \kern3pt\vrule
  2402.             \hskip\rskip
  2403.         \egroup
  2404.         \cartbot
  2405.     \egroup
  2406. \endgroup
  2407. % This macro is called at the beginning of all the @example variants,
  2408. % inside a group.
  2409. \def\nonfillstart{%
  2410.   \aboveenvbreak
  2411.   \inENV % This group ends at the end of the body
  2412.   \hfuzz = 12pt % Don't be fussy
  2413.   \sepspaces % Make spaces be word-separators rather than space tokens.
  2414.   \singlespace
  2415.   \let\par = \lisppar % don't ignore blank lines
  2416.   \obeylines % each line of input is a line of output
  2417.   \parskip = 0pt
  2418.   \parindent = 0pt
  2419.   \emergencystretch = 0pt % don't try to avoid overfull boxes
  2420.   % @cartouche defines \nonarrowing to inhibit narrowing
  2421.   % at next level down.
  2422.   \ifx\nonarrowing\relax
  2423.     \advance \leftskip by \lispnarrowing
  2424.     \exdentamount=\lispnarrowing
  2425.     \let\exdent=\nofillexdent
  2426.     \let\nonarrowing=\relax
  2427.   \fi
  2428. % To ending an @example-like environment, we first end the paragraph
  2429. % (via \afterenvbreak's vertical glue), and then the group.  That way we
  2430. % keep the zero \parskip that the environments set -- \parskip glue
  2431. % will be inserted at the beginning of the next paragraph in the
  2432. % document, after the environment.
  2433. \def\nonfillfinish{\afterenvbreak\endgroup}%
  2434. % This macro is
  2435. \def\lisp{\begingroup
  2436.   \nonfillstart
  2437.   \let\Elisp = \nonfillfinish
  2438.   \tt
  2439.   \rawbackslash % have \ input char produce \ char from current font
  2440.   \gobble
  2441. % Define the \E... control sequence only if we are inside the
  2442. % environment, so the error checking in \end will work.
  2443. % We must call \lisp last in the definition, since it reads the
  2444. % return following the @example (or whatever) command.
  2445. \def\example{\begingroup \def\Eexample{\nonfillfinish\endgroup}\lisp}
  2446. \def\smallexample{\begingroup \def\Esmallexample{\nonfillfinish\endgroup}\lisp}
  2447. \def\smalllisp{\begingroup \def\Esmalllisp{\nonfillfinish\endgroup}\lisp}
  2448. % @smallexample and @smalllisp.  This is not used unless the @smallbook
  2449. % command is given.  Originally contributed by Pavel@xerox.
  2450. \def\smalllispx{\begingroup
  2451.   \nonfillstart
  2452.   \let\Esmalllisp = \nonfillfinish
  2453.   \let\Esmallexample = \nonfillfinish
  2454.   % Smaller interline space and fonts for small examples.
  2455.   \baselineskip 10pt
  2456.   \indexfonts \tt
  2457.   \rawbackslash % output the \ character from the current font
  2458.   \gobble
  2459. % This is @display; same as @lisp except use roman font.
  2460. \def\display{\begingroup
  2461.   \nonfillstart
  2462.   \let\Edisplay = \nonfillfinish
  2463.   \gobble
  2464. % This is @format; same as @display except don't narrow margins.
  2465. \def\format{\begingroup
  2466.   \let\nonarrowing = t
  2467.   \nonfillstart
  2468.   \let\Eformat = \nonfillfinish
  2469.   \gobble
  2470. % @flushleft (same as @format) and @flushright.
  2471. \def\flushleft{\begingroup
  2472.   \let\nonarrowing = t
  2473.   \nonfillstart
  2474.   \let\Eflushleft = \nonfillfinish
  2475.   \gobble
  2476. \def\flushright{\begingroup
  2477.   \let\nonarrowing = t
  2478.   \nonfillstart
  2479.   \let\Eflushright = \nonfillfinish
  2480.   \advance\leftskip by 0pt plus 1fill
  2481.   \gobble}
  2482. % @quotation does normal linebreaking and narrows the margins.
  2483. \def\quotation{%
  2484. \begingroup\inENV %This group ends at the end of the @quotation body
  2485. {\parskip=0pt  % because we will skip by \parskip too, later
  2486. \aboveenvbreak}%
  2487. \singlespace
  2488. \parindent=0pt
  2489. \let\Equotation = \nonfillfinish
  2490. % @cartouche defines \nonarrowing to inhibit narrowing
  2491. % at next level down.
  2492. \ifx\nonarrowing\relax
  2493. \advance \leftskip by \lispnarrowing
  2494. \advance \rightskip by \lispnarrowing
  2495. \exdentamount=\lispnarrowing
  2496. \let\nonarrowing=\relax
  2497. \message{defuns,}
  2498. % Define formatter for defuns
  2499. % First, allow user to change definition object font (\df) internally
  2500. \def\setdeffont #1 {\csname DEF#1\endcsname}
  2501. \newskip\defbodyindent \defbodyindent=.4in
  2502. \newskip\defargsindent \defargsindent=50pt
  2503. \newskip\deftypemargin \deftypemargin=12pt
  2504. \newskip\deflastargmargin \deflastargmargin=18pt
  2505. \newcount\parencount
  2506. % define \functionparens, which makes ( and ) and & do special things.
  2507. % \functionparens affects the group it is contained in.
  2508. \def\activeparens{%
  2509. \catcode`\(=\active \catcode`\)=\active \catcode`\&=\active
  2510. \catcode`\[=\active \catcode`\]=\active}
  2511. % Make control sequences which act like normal parenthesis chars.
  2512. \let\lparen = ( \let\rparen = )
  2513. {\activeparens % Now, smart parens don't turn on until &foo (see \amprm)
  2514. % Be sure that we always have a definition for `(', etc.  For example,
  2515. % if the fn name has parens in it, \boldbrax will not be in effect yet,
  2516. % so TeX would otherwise complain about undefined control sequence.
  2517. \global\let(=\lparen \global\let)=\rparen
  2518. \global\let[=\lbrack \global\let]=\rbrack
  2519. \gdef\functionparens{\boldbrax\let&=\amprm\parencount=0 }
  2520. \gdef\boldbrax{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb}
  2521. % Definitions of (, ) and & used in args for functions.
  2522. % This is the definition of ( outside of all parentheses.
  2523. \gdef\oprm#1 {{\rm\char`\(}#1 \bf \let(=\opnested %
  2524. \global\advance\parencount by 1 }
  2525. % This is the definition of ( when already inside a level of parens.
  2526. \gdef\opnested{\char`\(\global\advance\parencount by 1 }
  2527. \gdef\clrm{% Print a paren in roman if it is taking us back to depth of 0.
  2528. % also in that case restore the outer-level definition of (.
  2529. \ifnum \parencount=1 {\rm \char `\)}\sl \let(=\oprm \else \char `\) \fi
  2530. \global\advance \parencount by -1 }
  2531. % If we encounter &foo, then turn on ()-hacking afterwards
  2532. \gdef\amprm#1 {{\rm\}\let(=\oprm \let)=\clrm\ }
  2533. \gdef\normalparens{\boldbrax\let&=\ampnr}
  2534. } % End of definition inside \activeparens
  2535. %% These parens (in \boldbrax) actually are a little bolder than the
  2536. %% contained text.  This is especially needed for [ and ]
  2537. \def\opnr{{\sf\char`\(}} \def\clnr{{\sf\char`\)}} \def\ampnr{\&}
  2538. \def\lbrb{{\bf\char`\[}} \def\rbrb{{\bf\char`\]}}
  2539. % First, defname, which formats the header line itself.
  2540. % #1 should be the function name.
  2541. % #2 should be the type of definition, such as "Function".
  2542. \def\defname #1#2{%
  2543. % Get the values of \leftskip and \rightskip as they were
  2544. % outside the @def...
  2545. \dimen2=\leftskip
  2546. \advance\dimen2 by -\defbodyindent
  2547. \dimen3=\rightskip
  2548. \advance\dimen3 by -\defbodyindent
  2549. \noindent        %
  2550. \setbox0=\hbox{\hskip \deflastargmargin{\rm #2}\hskip \deftypemargin}%
  2551. \dimen0=\hsize \advance \dimen0 by -\wd0 % compute size for first line
  2552. \dimen1=\hsize \advance \dimen1 by -\defargsindent %size for continuations
  2553. \parshape 2 0in \dimen0 \defargsindent \dimen1     %
  2554. % Now output arg 2 ("Function" or some such)
  2555. % ending at \deftypemargin from the right margin,
  2556. % but stuck inside a box of width 0 so it does not interfere with linebreaking
  2557. {% Adjust \hsize to exclude the ambient margins,
  2558. % so that \rightline will obey them.
  2559. \advance \hsize by -\dimen2 \advance \hsize by -\dimen3
  2560. \rlap{\rightline{{\rm #2}\hskip \deftypemargin}}}%
  2561. % Make all lines underfull and no complaints:
  2562. \tolerance=10000 \hbadness=10000
  2563. \advance\leftskip by -\defbodyindent
  2564. \exdentamount=\defbodyindent
  2565. {\df #1}\enskip        % Generate function name
  2566. % Actually process the body of a definition
  2567. % #1 should be the terminating control sequence, such as \Edefun.
  2568. % #2 should be the "another name" control sequence, such as \defunx.
  2569. % #3 should be the control sequence that actually processes the header,
  2570. %    such as \defunheader.
  2571. \def\defparsebody #1#2#3{\begingroup\inENV% Environment for definitionbody
  2572. \medbreak %
  2573. % Define the end token that this defining construct specifies
  2574. % so that it will exit this group.
  2575. \def#1{\endgraf\endgroup\medbreak}%
  2576. \def#2{\begingroup\obeylines\activeparens\spacesplit#3}%
  2577. \parindent=0in
  2578. \advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent
  2579. \exdentamount=\defbodyindent
  2580. \begingroup %
  2581. \catcode 61=\active % 61 is `='
  2582. \obeylines\activeparens\spacesplit#3}
  2583. \def\defmethparsebody #1#2#3#4 {\begingroup\inENV %
  2584. \medbreak %
  2585. % Define the end token that this defining construct specifies
  2586. % so that it will exit this group.
  2587. \def#1{\endgraf\endgroup\medbreak}%
  2588. \def#2##1 {\begingroup\obeylines\activeparens\spacesplit{#3{##1}}}%
  2589. \parindent=0in
  2590. \advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent
  2591. \exdentamount=\defbodyindent
  2592. \begingroup\obeylines\activeparens\spacesplit{#3{#4}}}
  2593. \def\defopparsebody #1#2#3#4#5 {\begingroup\inENV %
  2594. \medbreak %
  2595. % Define the end token that this defining construct specifies
  2596. % so that it will exit this group.
  2597. \def#1{\endgraf\endgroup\medbreak}%
  2598. \def#2##1 ##2 {\def#4{##1}%
  2599. \begingroup\obeylines\activeparens\spacesplit{#3{##2}}}%
  2600. \parindent=0in
  2601. \advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent
  2602. \exdentamount=\defbodyindent
  2603. \begingroup\obeylines\activeparens\spacesplit{#3{#5}}}
  2604. % These parsing functions are similar to the preceding ones
  2605. % except that they do not make parens into active characters.
  2606. % These are used for "variables" since they have no arguments.
  2607. \def\defvarparsebody #1#2#3{\begingroup\inENV% Environment for definitionbody
  2608. \medbreak %
  2609. % Define the end token that this defining construct specifies
  2610. % so that it will exit this group.
  2611. \def#1{\endgraf\endgroup\medbreak}%
  2612. \def#2{\begingroup\obeylines\spacesplit#3}%
  2613. \parindent=0in
  2614. \advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent
  2615. \exdentamount=\defbodyindent
  2616. \begingroup %
  2617. \catcode 61=\active %
  2618. \obeylines\spacesplit#3}
  2619. % This is used for \def{tp,vr}parsebody.  It could probably be used for
  2620. % some of the others, too, with some judicious conditionals.
  2621. \def\parsebodycommon#1#2#3{%
  2622.   \begingroup\inENV %
  2623.   \medbreak %
  2624.   % Define the end token that this defining construct specifies
  2625.   % so that it will exit this group.
  2626.   \def#1{\endgraf\endgroup\medbreak}%
  2627.   \def#2##1 {\begingroup\obeylines\spacesplit{#3{##1}}}%
  2628.   \parindent=0in
  2629.   \advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent
  2630.   \exdentamount=\defbodyindent
  2631.   \begingroup\obeylines
  2632. \def\defvrparsebody#1#2#3#4 {%
  2633.   \parsebodycommon{#1}{#2}{#3}%
  2634.   \spacesplit{#3{#4}}%
  2635. % This loses on `@deftp {Data Type} {struct termios}' -- it thinks the
  2636. % type is just `struct', because we lose the braces in `{struct
  2637. % termios}' when \spacesplit reads its undelimited argument.  Sigh.
  2638. % \let\deftpparsebody=\defvrparsebody
  2639. % So, to get around this, we put \empty in with the type name.  That
  2640. % way, TeX won't find exactly `{...}' as an undelimited argument, and
  2641. % won't strip off the braces.
  2642. \def\deftpparsebody #1#2#3#4 {%
  2643.   \parsebodycommon{#1}{#2}{#3}%
  2644.   \spacesplit{\parsetpheaderline{#3{#4}}}\empty
  2645. % Fine, but then we have to eventually remove the \empty *and* the
  2646. % braces (if any).  That's what this does, putting the result in \tptemp.
  2647. \def\removeemptybraces\empty#1\relax{\def\tptemp{#1}}%
  2648. % After \spacesplit has done its work, this is called -- #1 is the final
  2649. % thing to call, #2 the type name (which starts with \empty), and #3
  2650. % (which might be empty) the arguments.
  2651. \def\parsetpheaderline#1#2#3{%
  2652.   \removeemptybraces#2\relax
  2653.   #1{\tptemp}{#3}%
  2654. \def\defopvarparsebody #1#2#3#4#5 {\begingroup\inENV %
  2655. \medbreak %
  2656. % Define the end token that this defining construct specifies
  2657. % so that it will exit this group.
  2658. \def#1{\endgraf\endgroup\medbreak}%
  2659. \def#2##1 ##2 {\def#4{##1}%
  2660. \begingroup\obeylines\spacesplit{#3{##2}}}%
  2661. \parindent=0in
  2662. \advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent
  2663. \exdentamount=\defbodyindent
  2664. \begingroup\obeylines\spacesplit{#3{#5}}}
  2665. % Split up #2 at the first space token.
  2666. % call #1 with two arguments:
  2667. %  the first is all of #2 before the space token,
  2668. %  the second is all of #2 after that space token.
  2669. % If #2 contains no space token, all of it is passed as the first arg
  2670. % and the second is passed as empty.
  2671. {\obeylines
  2672. \gdef\spacesplit#1#2^^M{\endgroup\spacesplitfoo{#1}#2 \relax\spacesplitfoo}%
  2673. \long\gdef\spacesplitfoo#1#2 #3#4\spacesplitfoo{%
  2674. \ifx\relax #3%
  2675. #1{#2}{}\else #1{#2}{#3#4}\fi}}
  2676. % So much for the things common to all kinds of definitions.
  2677. % Define @defun.
  2678. % First, define the processing that is wanted for arguments of \defun
  2679. % Use this to expand the args and terminate the paragraph they make up
  2680. \def\defunargs #1{\functionparens \sl
  2681. % Expand, preventing hyphenation at `-' chars.
  2682. % Note that groups don't affect changes in \hyphenchar.
  2683. \hyphenchar\tensl=0
  2684. \hyphenchar\tensl=45
  2685. \ifnum\parencount=0 \else \errmessage{unbalanced parens in @def arguments}\fi%
  2686. \interlinepenalty=10000
  2687. \advance\rightskip by 0pt plus 1fil
  2688. \endgraf\penalty 10000\vskip -\parskip\penalty 10000%
  2689. \def\deftypefunargs #1{%
  2690. % Expand, preventing hyphenation at `-' chars.
  2691. % Note that groups don't affect changes in \hyphenchar.
  2692. \functionparens
  2693. \tclose{#1}% avoid \code because of side effects on active chars
  2694. \interlinepenalty=10000
  2695. \advance\rightskip by 0pt plus 1fil
  2696. \endgraf\penalty 10000\vskip -\parskip\penalty 10000%
  2697. % Do complete processing of one @defun or @defunx line already parsed.
  2698. % @deffn Command forward-char nchars
  2699. \def\deffn{\defmethparsebody\Edeffn\deffnx\deffnheader}
  2700. \def\deffnheader #1#2#3{\doind {fn}{\code{#2}}%
  2701. \begingroup\defname {#2}{#1}\defunargs{#3}\endgroup %
  2702. \catcode 61=\other % Turn off change made in \defparsebody
  2703. % @defun == @deffn Function
  2704. \def\defun{\defparsebody\Edefun\defunx\defunheader}
  2705. \def\defunheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index
  2706. \begingroup\defname {#1}{Function}%
  2707. \defunargs {#2}\endgroup %
  2708. \catcode 61=\other % Turn off change made in \defparsebody
  2709. % @deftypefun int foobar (int @var{foo}, float @var{bar})
  2710. \def\deftypefun{\defparsebody\Edeftypefun\deftypefunx\deftypefunheader}
  2711. % #1 is the data type.  #2 is the name and args.
  2712. \def\deftypefunheader #1#2{\deftypefunheaderx{#1}#2 \relax}
  2713. % #1 is the data type, #2 the name, #3 the args.
  2714. \def\deftypefunheaderx #1#2 #3\relax{%
  2715. \doind {fn}{\code{#2}}% Make entry in function index
  2716. \begingroup\defname {\code{#1} #2}{Function}%
  2717. \deftypefunargs {#3}\endgroup %
  2718. \catcode 61=\other % Turn off change made in \defparsebody
  2719. % @deftypefn {Library Function} int foobar (int @var{foo}, float @var{bar})
  2720. \def\deftypefn{\defmethparsebody\Edeftypefn\deftypefnx\deftypefnheader}
  2721. % #1 is the classification.  #2 is the data type.  #3 is the name and args.
  2722. \def\deftypefnheader #1#2#3{\deftypefnheaderx{#1}{#2}#3 \relax}
  2723. % #1 is the classification, #2 the data type, #3 the name, #4 the args.
  2724. \def\deftypefnheaderx #1#2#3 #4\relax{%
  2725. \doind {fn}{\code{#3}}% Make entry in function index
  2726. \begingroup
  2727. \normalparens % notably, turn off `&' magic, which prevents
  2728. %               at least some C++ text from working
  2729. \defname {\code{#2} #3}{#1}%
  2730. \deftypefunargs {#4}\endgroup %
  2731. \catcode 61=\other % Turn off change made in \defparsebody
  2732. % @defmac == @deffn Macro
  2733. \def\defmac{\defparsebody\Edefmac\defmacx\defmacheader}
  2734. \def\defmacheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index
  2735. \begingroup\defname {#1}{Macro}%
  2736. \defunargs {#2}\endgroup %
  2737. \catcode 61=\other % Turn off change made in \defparsebody
  2738. % @defspec == @deffn Special Form
  2739. \def\defspec{\defparsebody\Edefspec\defspecx\defspecheader}
  2740. \def\defspecheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index
  2741. \begingroup\defname {#1}{Special Form}%
  2742. \defunargs {#2}\endgroup %
  2743. \catcode 61=\other % Turn off change made in \defparsebody
  2744. % This definition is run if you use @defunx
  2745. % anywhere other than immediately after a @defun or @defunx.
  2746. \def\deffnx #1 {\errmessage{@deffnx in invalid context}}
  2747. \def\defunx #1 {\errmessage{@defunx in invalid context}}
  2748. \def\defmacx #1 {\errmessage{@defmacx in invalid context}}
  2749. \def\defspecx #1 {\errmessage{@defspecx in invalid context}}
  2750. \def\deftypefnx #1 {\errmessage{@deftypefnx in invalid context}}
  2751. \def\deftypeunx #1 {\errmessage{@deftypeunx in invalid context}}
  2752. % @defmethod, and so on
  2753. % @defop {Funny Method} foo-class frobnicate argument
  2754. \def\defop #1 {\def\defoptype{#1}%
  2755. \defopparsebody\Edefop\defopx\defopheader\defoptype}
  2756. \def\defopheader #1#2#3{%
  2757. \dosubind {fn}{\code{#2}}{on #1}% Make entry in function index
  2758. \begingroup\defname {#2}{\defoptype{} on #1}%
  2759. \defunargs {#3}\endgroup %
  2760. % @defmethod == @defop Method
  2761. \def\defmethod{\defmethparsebody\Edefmethod\defmethodx\defmethodheader}
  2762. \def\defmethodheader #1#2#3{%
  2763. \dosubind {fn}{\code{#2}}{on #1}% entry in function index
  2764. \begingroup\defname {#2}{Method on #1}%
  2765. \defunargs {#3}\endgroup %
  2766. % @defcv {Class Option} foo-class foo-flag
  2767. \def\defcv #1 {\def\defcvtype{#1}%
  2768. \defopvarparsebody\Edefcv\defcvx\defcvarheader\defcvtype}
  2769. \def\defcvarheader #1#2#3{%
  2770. \dosubind {vr}{\code{#2}}{of #1}% Make entry in var index
  2771. \begingroup\defname {#2}{\defcvtype{} of #1}%
  2772. \defvarargs {#3}\endgroup %
  2773. % @defivar == @defcv {Instance Variable}
  2774. \def\defivar{\defvrparsebody\Edefivar\defivarx\defivarheader}
  2775. \def\defivarheader #1#2#3{%
  2776. \dosubind {vr}{\code{#2}}{of #1}% Make entry in var index
  2777. \begingroup\defname {#2}{Instance Variable of #1}%
  2778. \defvarargs {#3}\endgroup %
  2779. % These definitions are run if you use @defmethodx, etc.,
  2780. % anywhere other than immediately after a @defmethod, etc.
  2781. \def\defopx #1 {\errmessage{@defopx in invalid context}}
  2782. \def\defmethodx #1 {\errmessage{@defmethodx in invalid context}}
  2783. \def\defcvx #1 {\errmessage{@defcvx in invalid context}}
  2784. \def\defivarx #1 {\errmessage{@defivarx in invalid context}}
  2785. % Now @defvar
  2786. % First, define the processing that is wanted for arguments of @defvar.
  2787. % This is actually simple: just print them in roman.
  2788. % This must expand the args and terminate the paragraph they make up
  2789. \def\defvarargs #1{\normalparens #1%
  2790. \interlinepenalty=10000
  2791. \endgraf\penalty 10000\vskip -\parskip\penalty 10000}
  2792. % @defvr Counter foo-count
  2793. \def\defvr{\defvrparsebody\Edefvr\defvrx\defvrheader}
  2794. \def\defvrheader #1#2#3{\doind {vr}{\code{#2}}%
  2795. \begingroup\defname {#2}{#1}\defvarargs{#3}\endgroup}
  2796. % @defvar == @defvr Variable
  2797. \def\defvar{\defvarparsebody\Edefvar\defvarx\defvarheader}
  2798. \def\defvarheader #1#2{\doind {vr}{\code{#1}}% Make entry in var index
  2799. \begingroup\defname {#1}{Variable}%
  2800. \defvarargs {#2}\endgroup %
  2801. % @defopt == @defvr {User Option}
  2802. \def\defopt{\defvarparsebody\Edefopt\defoptx\defoptheader}
  2803. \def\defoptheader #1#2{\doind {vr}{\code{#1}}% Make entry in var index
  2804. \begingroup\defname {#1}{User Option}%
  2805. \defvarargs {#2}\endgroup %
  2806. % @deftypevar int foobar
  2807. \def\deftypevar{\defvarparsebody\Edeftypevar\deftypevarx\deftypevarheader}
  2808. % #1 is the data type.  #2 is the name.
  2809. \def\deftypevarheader #1#2{%
  2810. \doind {vr}{\code{#2}}% Make entry in variables index
  2811. \begingroup\defname {\code{#1} #2}{Variable}%
  2812. \interlinepenalty=10000
  2813. \endgraf\penalty 10000\vskip -\parskip\penalty 10000
  2814. \endgroup}
  2815. % @deftypevr {Global Flag} int enable
  2816. \def\deftypevr{\defvrparsebody\Edeftypevr\deftypevrx\deftypevrheader}
  2817. \def\deftypevrheader #1#2#3{\doind {vr}{\code{#3}}%
  2818. \begingroup\defname {\code{#2} #3}{#1}
  2819. \interlinepenalty=10000
  2820. \endgraf\penalty 10000\vskip -\parskip\penalty 10000
  2821. \endgroup}
  2822. % This definition is run if you use @defvarx
  2823. % anywhere other than immediately after a @defvar or @defvarx.
  2824. \def\defvrx #1 {\errmessage{@defvrx in invalid context}}
  2825. \def\defvarx #1 {\errmessage{@defvarx in invalid context}}
  2826. \def\defoptx #1 {\errmessage{@defoptx in invalid context}}
  2827. \def\deftypevarx #1 {\errmessage{@deftypevarx in invalid context}}
  2828. \def\deftypevrx #1 {\errmessage{@deftypevrx in invalid context}}
  2829. % Now define @deftp
  2830. % Args are printed in bold, a slight difference from @defvar.
  2831. \def\deftpargs #1{\bf \defvarargs{#1}}
  2832. % @deftp Class window height width ...
  2833. \def\deftp{\deftpparsebody\Edeftp\deftpx\deftpheader}
  2834. \def\deftpheader #1#2#3{\doind {tp}{\code{#2}}%
  2835. \begingroup\defname {#2}{#1}\deftpargs{#3}\endgroup}
  2836. % This definition is run if you use @deftpx, etc
  2837. % anywhere other than immediately after a @deftp, etc.
  2838. \def\deftpx #1 {\errmessage{@deftpx in invalid context}}
  2839. \message{cross reference,}
  2840. % Define cross-reference macros
  2841. \newwrite \auxfile
  2842. \newif\ifhavexrefs  % True if xref values are known.
  2843. \newif\ifwarnedxrefs  % True if we warned once that they aren't known.
  2844. % \setref{foo} defines a cross-reference point named foo.
  2845. \def\setref#1{%
  2846. \dosetq{#1-title}{Ytitle}%
  2847. \dosetq{#1-pg}{Ypagenumber}%
  2848. \dosetq{#1-snt}{Ysectionnumberandtype}}
  2849. \def\unnumbsetref#1{%
  2850. \dosetq{#1-title}{Ytitle}%
  2851. \dosetq{#1-pg}{Ypagenumber}%
  2852. \dosetq{#1-snt}{Ynothing}}
  2853. \def\appendixsetref#1{%
  2854. \dosetq{#1-title}{Ytitle}%
  2855. \dosetq{#1-pg}{Ypagenumber}%
  2856. \dosetq{#1-snt}{Yappendixletterandtype}}
  2857. % \xref, \pxref, and \ref generate cross-references to specified points.
  2858. % For \xrefX, #1 is the node name, #2 the name of the Info
  2859. % cross-reference, #3 the printed node name, #4 the name of the Info
  2860. % file, #5 the name of the printed manual.  All but the node name can be
  2861. % omitted.
  2862. \def\pxref#1{\putwordsee{} \xrefX[#1,,,,,,,]}
  2863. \def\xref#1{\putwordSee{} \xrefX[#1,,,,,,,]}
  2864. \def\ref#1{\xrefX[#1,,,,,,,]}
  2865. \def\xrefX[#1,#2,#3,#4,#5,#6]{\begingroup%
  2866. \def\printedmanual{\ignorespaces #5}%
  2867. \def\printednodename{\ignorespaces #3}%
  2868. \setbox1=\hbox{\printedmanual}%
  2869. \setbox0=\hbox{\printednodename}%
  2870. \ifdim \wd0=0pt%
  2871. % No printed node name was explicitly given.
  2872. \ifx SETxref-automatic-section-title %
  2873. % This line should make the actual chapter or section title appear inside
  2874. % the square brackets.  Use the real section title if we have it.
  2875. \ifdim \wd1>0pt%
  2876. % It is in another manual, so we don't have it.
  2877. \def\printednodename{\ignorespaces #1} \else%
  2878. % We know the real title if we have the xref values.
  2879. \ifhavexrefs \def\printednodename{\refx{#1-title}}%
  2880. % Otherwise just copy the Info node name.
  2881. \else \def\printednodename{\ignorespaces #1} \fi%
  2882. \fi\def\printednodename{#1-title}%
  2883. \else% This line just uses the node name.
  2884. \def\printednodename{\ignorespaces #1}%
  2885. \fi% ends \ifx SETxref-automatic-section-title
  2886. \fi% ends \ifdim \wd0
  2887. % If we use \unhbox0 and \unhbox1 to print the node names, TeX does
  2888. % not insert empty discretionaries after hyphens, which means that it
  2889. % will not find a line break at a hyphen in a node names.  Since some
  2890. % manuals are best written with fairly long node names, containing
  2891. % hyphens, this is a loss.  Therefore, we simply give the text of
  2892. % the node name again, so it is as if TeX is seeing it for the first
  2893. % time.
  2894. \ifdim \wd1>0pt
  2895. \putwordsection{} ``\printednodename'' in \cite{\printedmanual}%
  2896. \else%
  2897. \turnoffactive%
  2898. \refx{#1-snt}{} [\printednodename], \putwordpage\tie\refx{#1-pg}{}%
  2899. \endgroup}
  2900. % \dosetq is the interface for calls from other macros
  2901. % Use \turnoffactive so that punctuation chars such as underscore
  2902. % work in node names.
  2903. \def\dosetq #1#2{{\let\folio=0 \turnoffactive%
  2904. \edef\next{\write\auxfile{\internalsetq {#1}{#2}}}%
  2905. \next}}
  2906. % \internalsetq {foo}{page} expands into
  2907. % CHARACTERS 'xrdef {foo}{...expansion of \Ypage...}
  2908. % When the aux file is read, ' is the escape character
  2909. \def\internalsetq #1#2{'xrdef {#1}{\csname #2\endcsname}}
  2910. % Things to be expanded by \internalsetq
  2911. \def\Ypagenumber{\folio}
  2912. \def\Ytitle{\thissection}
  2913. \def\Ynothing{}
  2914. \def\Ysectionnumberandtype{%
  2915. \ifnum\secno=0 \putwordChapter\xreftie\the\chapno %
  2916. \else \ifnum \subsecno=0 \putwordSection\xreftie\the\chapno.\the\secno %
  2917. \else \ifnum \subsubsecno=0 %
  2918. \putwordSection\xreftie\the\chapno.\the\secno.\the\subsecno %
  2919. \else %
  2920. \putwordSection\xreftie\the\chapno.\the\secno.\the\subsecno.\the\subsubsecno %
  2921. \fi \fi \fi }
  2922. \def\Yappendixletterandtype{%
  2923. \ifnum\secno=0 \putwordAppendix\xreftie'char\the\appendixno{}%
  2924. \else \ifnum \subsecno=0 \putwordSection\xreftie'char\the\appendixno.\the\secno %
  2925. \else \ifnum \subsubsecno=0 %
  2926. \putwordSection\xreftie'char\the\appendixno.\the\secno.\the\subsecno %
  2927. \else %
  2928. \putwordSection\xreftie'char\the\appendixno.\the\secno.\the\subsecno.\the\subsubsecno %
  2929. \fi \fi \fi }
  2930. \gdef\xreftie{'tie}
  2931. % Use TeX 3.0's \inputlineno to get the line number, for better error
  2932. % messages, but if we're using an old version of TeX, don't do anything.
  2933. \ifx\inputlineno\thisisundefined
  2934.   \let\linenumber = \empty % Non-3.0.
  2935. \else
  2936.   \def\linenumber{\the\inputlineno:\space}
  2937. % Define \refx{NAME}{SUFFIX} to reference a cross-reference string named NAME.
  2938. % If its value is nonempty, SUFFIX is output afterward.
  2939. \def\refx#1#2{%
  2940.   \expandafter\ifx\csname X#1\endcsname\relax
  2941.     % If not defined, say something at least.
  2942.     $\langle$un\-de\-fined$\rangle$%
  2943.     \ifhavexrefs
  2944.       \message{\linenumber Undefined cross reference `#1'.}%
  2945.     \else
  2946.       \ifwarnedxrefs\else
  2947.         \global\warnedxrefstrue
  2948.         \message{Cross reference values unknown; you must run TeX again.}%
  2949.       \fi
  2950.     \fi
  2951.   \else
  2952.     % It's defined, so just use it.
  2953.     \csname X#1\endcsname
  2954.   \fi
  2955.   #2% Output the suffix in any case.
  2956. % Read the last existing aux file, if any.  No error if none exists.
  2957. % This is the macro invoked by entries in the aux file.
  2958. \def\xrdef #1#2{
  2959. {\catcode`\'=\other\expandafter \gdef \csname X#1\endcsname {#2}}}
  2960. \def\readauxfile{%
  2961. \begingroup
  2962. \catcode `\^^@=\other
  2963. \catcode `\
  2964. =\other
  2965. \catcode `\
  2966. =\other
  2967. \catcode `\^^C=\other
  2968. \catcode `\^^D=\other
  2969. \catcode `\^^E=\other
  2970. \catcode `\^^F=\other
  2971. \catcode `\^^G=\other
  2972. \catcode `\^^H=\other
  2973. \catcode `\
  2974. =\other
  2975. \catcode `\^^L=\other
  2976. \catcode `\
  2977. =\other
  2978. \catcode `\
  2979. =\other
  2980. \catcode `\
  2981. =\other
  2982. \catcode `\
  2983. =\other
  2984. \catcode `\
  2985. =\other
  2986. \catcode `\
  2987. =\other
  2988. \catcode `\
  2989. =\other
  2990. \catcode `\
  2991. =\other
  2992. \catcode `\
  2993. =\other
  2994. \catcode `\
  2995. =\other
  2996. \catcode `\
  2997. =\other
  2998. \catcode `\
  2999. =\other
  3000. \catcode 26=\other
  3001. \catcode `\^^[=\other
  3002. \catcode `\^^\=\other
  3003. \catcode `\^^]=\other
  3004. \catcode `\^^^=\other
  3005. \catcode `\^^_=\other
  3006. \catcode `\@=\other
  3007. \catcode `\^=\other
  3008. \catcode `\~=\other
  3009. \catcode `\[=\other
  3010. \catcode `\]=\other
  3011. \catcode`\"=\other
  3012. \catcode`\_=\other
  3013. \catcode`\|=\other
  3014. \catcode`\<=\other
  3015. \catcode`\>=\other
  3016. \catcode `\$=\other
  3017. \catcode `\#=\other
  3018. \catcode `\&=\other
  3019. % `\+ does not work, so use 43.
  3020. \catcode 43=\other
  3021. % the aux file uses ' as the escape.
  3022. % Turn off \ as an escape so we do not lose on
  3023. % entries which were dumped with control sequences in their names.
  3024. % For example, 'xrdef {$\leq $-fun}{page ...} made by @defun ^^
  3025. % Reference to such entries still does not work the way one would wish,
  3026. % but at least they do not bomb out when the aux file is read in.
  3027. \catcode `\{=1 \catcode `\}=2
  3028. \catcode `\%=\other
  3029. \catcode `\'=0
  3030. \catcode `\\=\other
  3031. \openin 1 \jobname.aux
  3032. \ifeof 1 \else \closein 1 \input \jobname.aux \global\havexrefstrue
  3033. \global\warnedobstrue
  3034. % Open the new aux file.  Tex will close it automatically at exit.
  3035. \openout \auxfile=\jobname.aux
  3036. \endgroup}
  3037. % Footnotes.
  3038. \newcount \footnoteno
  3039. % The trailing space in the following definition for supereject is
  3040. % vital for proper filling; pages come out unaligned when you do a
  3041. % pagealignmacro call if that space before the closing brace is
  3042. % removed.
  3043. \def\supereject{\par\penalty -20000\footnoteno =0 }
  3044. % @footnotestyle is meaningful for info output only..
  3045. \let\footnotestyle=\comment
  3046. \let\ptexfootnote=\footnote
  3047. {\catcode `\@=11
  3048. % Auto-number footnotes.  Otherwise like plain.
  3049. \gdef\footnote{%
  3050.   \global\advance\footnoteno by \@ne
  3051.   \edef\thisfootno{$^{\the\footnoteno}$}%
  3052.   % In case the footnote comes at the end of a sentence, preserve the
  3053.   % extra spacing after we do the footnote number.
  3054.   \let\@sf\empty
  3055.   \ifhmode\edef\@sf{\spacefactor\the\spacefactor}\/\fi
  3056.   % Remove inadvertent blank space before typesetting the footnote number.
  3057.   \unskip
  3058.   \thisfootno\@sf
  3059.   \footnotezzz
  3060. % Don't bother with the trickery in plain.tex to not require the
  3061. % footnote text as a parameter.  Our footnotes don't need to be so general.
  3062. \long\gdef\footnotezzz#1{\insert\footins{%
  3063.   % We want to typeset this text as a normal paragraph, even if the
  3064.   % footnote reference occurs in (for example) a display environment.
  3065.   % So reset some parameters.
  3066.   \interlinepenalty\interfootnotelinepenalty
  3067.   \splittopskip\ht\strutbox % top baseline for broken footnotes
  3068.   \splitmaxdepth\dp\strutbox
  3069.   \floatingpenalty\@MM
  3070.   \leftskip\z@skip
  3071.   \rightskip\z@skip
  3072.   \spaceskip\z@skip
  3073.   \xspaceskip\z@skip
  3074.   \parindent\defaultparindent
  3075.   % Hang the footnote text off the number.
  3076.   \hang
  3077.   \textindent{\thisfootno}%
  3078.   % Don't crash into the line above the footnote text.  Since this
  3079.   % expands into a box, it must come within the paragraph, lest it
  3080.   % provide a place where TeX can split the footnote.
  3081.   \footstrut
  3082.   #1\strut}%
  3083. }%end \catcode `\@=11
  3084. % Set the baselineskip to #1, and the lineskip and strut size
  3085. % correspondingly.  There is no deep meaning behind these magic numbers
  3086. % used as factors; they just match (closely enough) what Knuth defined.
  3087. \def\lineskipfactor{.08333}
  3088. \def\strutheightpercent{.70833}
  3089. \def\strutdepthpercent {.29167}
  3090. \def\setleading#1{%
  3091.   \normalbaselineskip = #1\relax
  3092.   \normallineskip = \lineskipfactor\normalbaselineskip
  3093.   \normalbaselines
  3094.   \setbox\strutbox =\hbox{%
  3095.     \vrule width0pt height\strutheightpercent\baselineskip
  3096.                     depth \strutdepthpercent \baselineskip
  3097. % @| inserts a changebar to the left of the current line.  It should
  3098. % surround any changed text.  This approach does *not* work if the
  3099. % change spans more than two lines of output.  To handle that, we would
  3100. % have adopt a much more difficult approach (putting marks into the main
  3101. % vertical list for the beginning and end of each change).
  3102. \def\|{%
  3103.   % \vadjust can only be used in horizontal mode.
  3104.   \leavevmode
  3105.   % Append this vertical mode material after the current line in the output.
  3106.   \vadjust{%
  3107.     % We want to insert a rule with the height and depth of the current
  3108.     % leading; that is exactly what \strutbox is supposed to record.
  3109.     \vskip-\baselineskip
  3110.     %
  3111.     % \vadjust-items are inserted at the left edge of the type.  So
  3112.     % the \llap here moves out into the left-hand margin.
  3113.     \llap{%
  3114.       %
  3115.       % For a thicker or thinner bar, change the `1pt'.
  3116.       \vrule height\baselineskip width1pt
  3117.       %
  3118.       % This is the space between the bar and the text.
  3119.       \hskip 12pt
  3120.     }%
  3121. % For a final copy, take out the rectangles
  3122. % that mark overfull boxes (in case you have decided
  3123. % that the text looks ok even though it passes the margin).
  3124. \def\finalout{\overfullrule=0pt}
  3125. % End of control word definitions.
  3126. \message{and turning on texinfo input format.}
  3127. \def\openindices{%
  3128.    \newindex{cp}%
  3129.    \newcodeindex{fn}%
  3130.    \newcodeindex{vr}%
  3131.    \newcodeindex{tp}%
  3132.    \newcodeindex{ky}%
  3133.    \newcodeindex{pg}%
  3134. % Set some numeric style parameters, for 8.5 x 11 format.
  3135. %\hsize = 6.5in
  3136. \newdimen\defaultparindent \defaultparindent = 15pt
  3137. \parindent = \defaultparindent
  3138. \parskip 18pt plus 1pt
  3139. \setleading{15pt}
  3140. \advance\topskip by 1.2cm
  3141. % Prevent underfull vbox error messages.
  3142. \vbadness=10000
  3143. % Following George Bush, just get rid of widows and orphans.
  3144. \widowpenalty=10000
  3145. \clubpenalty=10000
  3146. % Use TeX 3.0's \emergencystretch to help line breaking, but if we're
  3147. % using an old version of TeX, don't do anything.  We want the amount of
  3148. % stretch added to depend on the line length, hence the dependence on
  3149. % \hsize.  This makes it come to about 9pt for the 8.5x11 format.
  3150. \ifx\emergencystretch\thisisundefined
  3151.   % Allow us to assign to \emergencystretch anyway.
  3152.   \def\emergencystretch{\dimen0}%
  3153. \else
  3154.   \emergencystretch = \hsize
  3155.   \divide\emergencystretch by 45
  3156. % Use @smallbook to reset parameters for 7x9.5 format  (or else 7x9.25)
  3157. \def\smallbook{
  3158. % These values for secheadingskip and subsecheadingskip are
  3159. % experiments.  RJC 7 Aug 1992
  3160. \global\secheadingskip = 17pt plus 6pt minus 3pt
  3161. \global\subsecheadingskip = 14pt plus 6pt minus 3pt
  3162. \global\lispnarrowing = 0.3in
  3163. \setleading{12pt}
  3164. \advance\topskip by -1cm
  3165. \global\parskip 3pt plus 1pt
  3166. \global\hsize = 5in
  3167. \global\vsize=7.5in
  3168. \global\tolerance=700
  3169. \global\hfuzz=1pt
  3170. \global\contentsrightmargin=0pt
  3171. \global\pagewidth=\hsize
  3172. \global\pageheight=\vsize
  3173. \global\let\smalllisp=\smalllispx
  3174. \global\let\smallexample=\smalllispx
  3175. \global\def\Esmallexample{\Esmalllisp}
  3176. % Use @afourpaper to print on European A4 paper.
  3177. \def\afourpaper{
  3178. \global\tolerance=700
  3179. \global\hfuzz=1pt
  3180. \setleading{12pt}
  3181. \global\parskip 15pt plus 1pt
  3182. \global\vsize= 53\baselineskip
  3183. \advance\vsize by \topskip
  3184. %\global\hsize=   5.85in     % A4 wide 10pt
  3185. \global\hsize=  6.5in
  3186. \global\outerhsize=\hsize
  3187. \global\advance\outerhsize by 0.5in
  3188. \global\outervsize=\vsize
  3189. \global\advance\outervsize by 0.6in
  3190. \global\pagewidth=\hsize
  3191. \global\pageheight=\vsize
  3192. % Define macros to output various characters with catcode for normal text.
  3193. \catcode`\"=\other
  3194. \catcode`\~=\other
  3195. \catcode`\^=\other
  3196. \catcode`\_=\other
  3197. \catcode`\|=\other
  3198. \catcode`\<=\other
  3199. \catcode`\>=\other
  3200. \catcode`\+=\other
  3201. \def\normaldoublequote{"}
  3202. \def\normaltilde{~}
  3203. \def\normalcaret{^}
  3204. \def\normalunderscore{_}
  3205. \def\normalverticalbar{|}
  3206. \def\normalless{<}
  3207. \def\normalgreater{>}
  3208. \def\normalplus{+}
  3209. % This macro is used to make a character print one way in ttfont
  3210. % where it can probably just be output, and another way in other fonts,
  3211. % where something hairier probably needs to be done.
  3212. % #1 is what to print if we are indeed using \tt; #2 is what to print
  3213. % otherwise.  Since all the Computer Modern typewriter fonts have zero
  3214. % interword stretch (and shrink), and it is reasonable to expect all
  3215. % typewriter fonts to have this, we can check that font parameter.
  3216. \def\ifusingtt#1#2{\ifdim \fontdimen3\the\font=0pt #1\else #2\fi}
  3217. % Turn off all special characters except @
  3218. % (and those which the user can use as if they were ordinary).
  3219. % Most of these we simply print from the \tt font, but for some, we can
  3220. % use math or other variants that look better in normal text.
  3221. \catcode`\"=\active
  3222. \def\activedoublequote{{\tt \char '042}}
  3223. \let"=\activedoublequote
  3224. \catcode`\~=\active
  3225. \def~{{\tt \char '176}}
  3226. \chardef\hat=`\^
  3227. \catcode`\^=\active
  3228. \def^{{\tt \hat}}
  3229. \catcode`\_=\active
  3230. \def_{\ifusingtt\normalunderscore\_}
  3231. % Subroutine for the previous macro.
  3232. \def\_{\lvvmode \kern.06em \vbox{\hrule width.3em height.1ex}}
  3233. % \lvvmode is equivalent in function to \leavevmode.
  3234. % Using \leavevmode runs into trouble when written out to
  3235. % an index file due to the expansion of \leavevmode into ``\unhbox
  3236. % \voidb@x'' ---which looks to TeX like ``\unhbox \voidb\x'' due to our
  3237. % magic tricks with @.
  3238. \def\lvvmode{\vbox to 0pt{}}
  3239. \catcode`\|=\active
  3240. \def|{{\tt \char '174}}
  3241. \chardef \less=`\<
  3242. \catcode`\<=\active
  3243. \def<{{\tt \less}}
  3244. \chardef \gtr=`\>
  3245. \catcode`\>=\active
  3246. \def>{{\tt \gtr}}
  3247. \catcode`\+=\active
  3248. \def+{{\tt \char 43}}
  3249. %\catcode 27=\active
  3250. %\def^^[{$\diamondsuit$}
  3251. % Used sometimes to turn off (effectively) the active characters
  3252. % even after parsing them.
  3253. \def\turnoffactive{\let"=\normaldoublequote
  3254. \let~=\normaltilde
  3255. \let^=\normalcaret
  3256. \let_=\normalunderscore
  3257. \let|=\normalverticalbar
  3258. \let<=\normalless
  3259. \let>=\normalgreater
  3260. \let+=\normalplus}
  3261. % Set up an active definition for =, but don't enable it most of the time.
  3262. {\catcode`\==\active
  3263. \global\def={{\tt \char 61}}}
  3264. \catcode`\@=0
  3265. % \rawbackslashxx output one backslash character in current font
  3266. \global\chardef\rawbackslashxx=`\\
  3267. %{\catcode`\\=\other
  3268. %@gdef@rawbackslashxx{\}}
  3269. % \rawbackslash redefines \ as input to do \rawbackslashxx.
  3270. {\catcode`\\=\active
  3271. @gdef@rawbackslash{@let\=@rawbackslashxx }}
  3272. % \normalbackslash outputs one backslash in fixed width font.
  3273. \def\normalbackslash{{\tt\rawbackslashxx}}
  3274. % Say @foo, not \foo, in error messages.
  3275. \escapechar=`\@
  3276. % \catcode 17=0   % Define control-q
  3277. \catcode`\\=\active
  3278. % If a .fmt file is being used, we don't want the `\input texinfo' to show up.
  3279. % That is what \eatinput is for; after that, the `\' should revert to printing
  3280. % a backslash.
  3281. @gdef@eatinput input texinfo{@fixbackslash}
  3282. @global@let\ = @eatinput
  3283. % On the other hand, perhaps the file did not have a `\input texinfo'. Then
  3284. % the first `\{ in the file would cause an error. This macro tries to fix
  3285. % that, assuming it is called before the first `\' could plausibly occur.
  3286. @gdef@fixbackslash{@ifx\@eatinput @let\ = @normalbackslash @fi}
  3287. %% These look ok in all fonts, so just make them not special.  The @rm below
  3288. %% makes sure that the current font starts out as the newly loaded cmr10
  3289. @catcode`@$=@other @catcode`@%=@other @catcode`@&=@other @catcode`@#=@other
  3290. @textfonts
  3291. @c Local variables:
  3292. @c page-delimiter: "^\\\\message"
  3293. @c End:
  3294.